If I have a non-scrolling header in an HTML page, fixed to the top, having a defined height:
Is there a way to use the URL anchor (the #fragment part) t
I've got it working easily with CSS and HTML, using the "anchor:before" method mentioned above. I think it works the best, because it doesn't create massive padding between your divs.
.anchor:before {
content:"";
display:block;
height:60px; /* fixed header height*/
margin:-60px 0 0; /* negative fixed header height */
}
It doesn't seem to work for the first div on the page, but you can counter that by adding padding to that first div.
#anchor-one{padding-top: 60px;}
Here's a working fiddle: http://jsfiddle.net/FRpHE/24/