This solution is great, but do you know the scroll-margin-top property? It is working according to your nav-bar height when on position: sticky. And solve the problem in a more consistent way.
Cheers
👋 Selftaught Accessibility & Frontend Developer
💻 Dev & UX Accessibility Specialist @Atos | CPACC
🙆 Improving the world with accessible web content
✍️ Content creator, Tips on How To Get Into Tech
This solution is great, but do you know the
scroll-margin-top
property? It is working according to your nav-bar height when onposition: sticky
. And solve the problem in a more consistent way.Cheers
Thank you. I will update the article immediately :)