Now use 2 lines of CSS to position them properly. This needs to work when it is a #anchor item in the URL. 511. The problem is that the section displayed is misplaced. }; top: -250px; Change the top value to match the height of your fixed header (or more). @harpo: Nice idea, but doesn't work. The Trick We can make this happen with a little CSS trick. Anchor link direct to anchor offset by a number of pixels? The issue I ran into (which Im surprised I havent seen discussed) is the trick of overlapping previous elements with padding or a transparent border prevents hover and click actions at the bottom of those sections because the following one comes higher in the z-order. I wrote this simple scrolling js, that accounts for the offset caused due to the header and relocated the div about 125 pixels below. Also, it completely solves the problem of how to make headings disappear behind navs with no background. What's important to remember with these properties is that they both apply only to scroll-snapping, so they do not affect the actual padding of the HTML element or the defined margin between anchor sections. @AlexanderSavin's solution works great in WebKit browsers for me. Offsetting an html anchor to adjust for fixed header using grid ); I had to use javascript and bind to the window hashchange event to work around this (demo): * Note: The hashchange event is not available in all browsers. Very nice! javascript - offsetting an html anchor to adjust for fixed header top:-200px; For modern browsers, just add the CSS3 :target selector to the page. Is it safe to publish research papers in cooperation with Russian academics? I use. Is it safe to publish research papers in cooperation with Russian academics? The way my webpage is set out the anchor tags jump to the correct places by the titles of the pages are hidden behind the fixed header. Share Improve this answer Follow answered Apr 18, 2016 at 22:37 Jordie C 1 Adjust values to match the height of your header. To learn more, see our tips on writing great answers. After that, for all anchors on page, you will need to add a class ( like for example 'good-anchor . html - How to scroll to an anchor with an offset? - Stack Overflow margin-top: -75px; A full solution should also include the scenario in which a user loads a new page with the anchor already in the address bar. This is one of the most common and flexible approaches for offsetting an anchor. Browser support for these solutions is great, as you can see here: scroll-margin-top,scroll-padding-top, so we can make use of them immediately with no ill-effects. When an anchor is clicked, The page will scroll to position the anchor at the very top of the viewport, meaning that the section title and perhaps even part of the content will be obscured by the fixed menu. * @return {Boolean} - Was the href an anchor. What's the function to find a city nearest to a given latitude? This takes many elements from previous answers and combines into a tiny (194 bytes minified) anonymous jQuery function. How can I set the default value for an HTML