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
Fixing Smooth Scrolling & Page Search
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;
}
}
Explore other pages
- svg
SVG is a language for describing two-dimensional graphics.
- data-
Stores data in a custom attribute.
- scroll-snap-type
Specifies whether a scroll container is a scroll snap container, how strictly it snaps, and which axes are considered.
- aspect-ratio
Sets a preferred aspect ratio for the box.