CSS: How can the anchor height be adjusted?

Often html anchors cannot be positioned correctly, so it would be desirable if the anchor already started a few pixels above the actual position.

a.anchorPos {
    display: block;
    position: relative;
    top: -250px;
    visibility: hidden;
}

A simple solution is the following CSS adjustment, which is deposited at the appropriate anchor:

scroll-margin-top: 1em;
Without cookies
This website does not use cookies or tracking. More information can be found in the privacy policy.