Black Lives Matter! ✊🏾

scroll-behavior

Specifies the scrolling behavior for a scrolling box, when scrolling happens due to navigation, CSSOM scrolling APIs, or scroll snapping operations not initiated by the user. 13.1. Smooth Scrolling: The scroll-behavior Property

Links about scroll-behavior

  1. Fixing Smooth Scrolling & Page Search

    posted on

    Native smooth scrolling is one more example of standards paving the cow path by declaring a wide-spread practice officially a thing: being able to smoothly scroll the viewport to another part of a page without the user losing their orientation. As good at it is, though, it also has an undesired …

Code sample

/* Animate scrolling only if users don’t prefer reduced motion */
@media (prefers-reduced-motion: no-preference) {
html {
scroll-behavior: smooth;
}
}