scroll-behavior
scroll-behavior controls whether browser-driven scrolling jumps instantly or animates smoothly. It affects anchor links and scripted scrolling that uses browser scrolling APIs.
Overview
scroll-behavior controls whether browser-driven scrolling jumps instantly or animates smoothly. It affects anchor links and scripted scrolling that uses browser scrolling APIs.
Browser support
| Feature | Desktop | Mobile | ||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Safari | Chrome Android | Safari iOS | |
| 61 | 79 | 36 | 15.4 | 61 | 15.4 | |
auto | 61 | 79 | 36 | 15.4 | 61 | 15.4 |
smooth | 61 | 79 | 36 | 15.4 | 61 | 15.4 |
1+Supported (version) Not supported ※Has note Sub-feature descriptions sourced from MDN Web Docs (CC BY-SA 2.5)
Syntax
CSS
html {
scroll-behavior: smooth;
}
/* Apply only to specific containers */
.scroll-area {
scroll-behavior: smooth;
overflow-y: auto;
} Live demo
Use cases
Anchor navigation
Help users track movement when jumping to headings, sections, or table-of-contents links.
Documentation layouts
Large docs and long-form guides benefit from smoother transitions between sections.
Cautions
- Overused smooth scrolling can feel slow or disorienting, especially in interfaces with frequent jumps.
- Do not force animated scrolling when the user prefers reduced motion.
Accessibility
- Pair smooth scrolling with prefers-reduced-motion so motion-sensitive users can avoid unnecessary animation.
Related links
Powered by web-features