Skip to content
Advertisement

Add a space on top of a #page HTML link

When I have a link that loads a section within the same page, the link will make the section clicked on load at the top of the browser window, I need to somehow add a space/gap of like 100px on top of all these sections that are linked like this.

Any ideas on how to do this?

JavaScript

Advertisement

Answer

In your css just set the padding-top to 100px (you’ll need some form of CSS selector to target only the ‘correct’ links):

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement