Reputation: 8274
Is there a way to set anchor points customley, in positions outside of where the actual HTML mark up is?
I'm using this simple parallax scrolling script called 'smoothscroll.js
' at 'http://www.kryogenix.org/code/browser/smoothscroll/smoothscroll.js'
It works by making links to anchor points. HOWEVER, I need to position them outside of where the markup lays. About 200px above.
I've tried external CSS with a class and inline.
EG:
<a name="kids" class="anchor" style="margin-top:-200px;"></a>
<a name="kids" class="anchor" style="margin-top:-200px;"></a>
.anchor { margin-top: -200px; }
Any suggestions?!
This question is a derivation of this one, Anchor point positionings (2 - Q points, for the help!)
Upvotes: 1
Views: 976
Reputation: 2751
Since a
is not a block element, margin-top
will not work as expected.
Here's some modified CSS:
.anchor {
display: block;
position: relative; /* relative to the parent container, needed for top/left positioning*/
top: -200px;
}
Upvotes: 2