TIL!
You don't need JS for smooth scrolling
I'm still not sure if I like this effect but here's how to do it:
html {scroll-behavior: smooth;}
You can add a scrolling offset to anchors
When you go to a section of a page via anchor, the header is often too close to the top edge. You can add a little bit of space there by specifying scroll-margin-top
:
[id] {scroll-margin-top: 50px;}
Last updated: