Adding an automatic offset to the scroll position for all hash-links/calls
Nowadays in 2021 there’s a nice simple only-css solution with :target and scroll-margin-top :target { scroll-margin-top: 100px; } It works in all major browsers References: https://developer.mozilla.org/en-US/docs/Web/CSS/scroll-margin-top https://developer.mozilla.org/en-US/docs/Web/CSS/%3Atarget