Scrolling and navbar height

I have a navbar created with Bootstrap, but when I anchor a text onpage, I click on it and it scrolls down, the navabr cover up the element. So I’m asking if is there a way to add some sort of “navbar height” element to the pages in order to avoid this problem. Probably it’s done via CSS, but it could also via JS as far as I know. If you want an example go here: and on the right box click on “Spazio Hosting Gratuito”.


The simplest way is to add an empty element with the id of the fragment identifier and shift it upwards by 100px (or whatever) with top:-100px using relative positoning. It hacky but it should work.

That’s one of the methods explained here.

Thank you so much, this is what I needed.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.