CSS: scroll-behavior

A quick thing I have learned today, which I thought was more difficult and it would take more time to get right than it actually does.

Do you know that effect when you click on a link to a section in a page (say from the nav) and the page smoothly scrolls until said section? Well, it is just a CSS property called... scroll-behavior with value... smooth. Duh.

Example:

html {
  scroll-behavior: smooth;
}

There are many other scroll-related properties related to snap points and margins, but this one alone goes a long way already.

#TIL #CSS #design