I have an anchor on a element which makes the navigation jump to that point. However the anchor snaps it right up to the top of the viewport. Due do a fixed navigation, it's now hidden behind.
Is it possible to make the anchor not snap to the top of the viewport and instead 200px down the page?
Site here: http://www.haselden.co.uk/james/docs
I was able to solve this by actually applying CSS to the anchor. So for the anchor I would have this...
<a name="AnchorName" class="anchor"></a>
And then in the CSS I would have this...
.anchor {
position: relative;
top: -[number]px;
}
Note that I have noticed some inaccuracies in how far the anchor is moved in different browsers. So it might not be possible to make things align perfectly. You'd probably need some fancy jquery or something if you wanted it to be perfectly positioned.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With