url - HTML position:fixed page header and in-page anchors -


if have non-scrolling header in html page, fixed top, having defined height:

is there way use url anchor (the #fragment part) have browser scroll point in page, still respect height of fixed element without of javascript?

http://foo.com/#bar 
 wrong (but common behavior):         correct: +---------------------------------+      +---------------------------------+ | bar///////////////////// header |      | //////////////////////// header | +---------------------------------+      +---------------------------------+ | here rest of text    |      | bar                             | | ...                             |      |                                 | | ...                             |      | here rest of text    | | ...                             |      | ...                             | +---------------------------------+      +---------------------------------+ 

i had same problem. solved adding class anchor element topbar height padding-top value.

<h1><a class="anchor" name="barlink">bar</a></h1> 

and css:

.anchor { padding-top: 90px; } 

Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -