-2

My problem is that I have a huge fixed header so whenever I do the regular HTML id link the id content is covered by the header. Is there a way to navigate to a slightly higher position of an id section using css?

  • Does this answer your question? [Fixed page header overlaps in-page anchors](https://stackoverflow.com/questions/4086107/fixed-page-header-overlaps-in-page-anchors) – Justinas Jul 07 '20 at 12:31
  • Please provide us with a minimal, complete and verifiable example and let us know what you've already tried to solve this. Read: [How do I ask a good question](https://stackoverflow.com/help/how-to-ask) – Terminator-Barbapapa Jul 07 '20 at 12:41

1 Answers1

0

Yes, you can, if you use scroll-margin i.e.

h2{scroll-margin: 40px}

This will offset your content from the top of the browser when using an ID link, but there are some gotchas namely I.E and partial support in Safari.

ref: https://developer.mozilla.org/en-US/docs/Web/CSS/scroll-margin

elmarko
  • 813
  • 7
  • 17