CSS scroll-behavior Property
Description
The scroll-behavior property controls how a scroll container responds when a scrolling action is initiated: it determines whether the change in scroll position happens instantly or is animated over time. This affects both viewport scrolling (for example when navigating to an in-page anchor) and scrolling of elements that are able to overflow. The property sets a default behavior for the container so that user navigation and many programmatic scroll invocations will follow the chosen behavior unless explicitly overridden.
When a script requests a scroll (via DOM scrolling methods), many user agents will honor the container’s configured behavior unless the script supplies an explicit instruction. Likewise, following anchor links or similar navigation events will typically use the container’s scrolling behavior. That means the property interacts closely with how focus is moved and how content comes into view, so it’s often used together with layout-related properties to ensure elements land in predictable positions after scroll operations — for example scroll-margin can be used to offset the final visible position so target content doesn’t sit flush against an edge.
Accessibility and user preferences should be considered when using animated scrolling. Users who prefer reduced motion may expect or require instant changes rather than animated transitions; many browsers and assistive settings will override or ignore animated scroll behavior when a user has indicated a reduced-motion preference, so you should not rely on animated scrolling as the only way of indicating navigation. Pairing scroll behavior with focus management and semantics (so keyboard and assistive tech users get a clear navigation experience) is important — also consider how it interacts with layout properties such as overflow, because if an element is not actually scrollable the property has no effect.
From an implementation and performance perspective, animated scrolling is generally handled on compositor threads in modern browsers to avoid blocking the main thread and to produce smooth motion; however, complex repaint or layout work triggered during a scroll can still cause jank. Use animated scrolling judiciously — it can improve perceived continuity for in-page navigation, but overuse (for many simultaneous large scrollable regions or heavy DOM updates during scrolling) can degrade performance. Finally, be aware of interactions with scrolling behaviors like snapping: containers that employ scroll-snapping via scroll-snap-type may combine snapping logic with the chosen scroll animation, so test to ensure the result matches your expected UX.
Definition
- Initial value
- auto
- Applies to
- scrolling boxes
- Inherited
- no
- Computed value
- as specified
- Animatable
- no
- JavaScript syntax
- object.style.scrollBehavior
Interactive Demo
Syntax
scroll-behavior: auto | smooth
Values
- autoThe scrolling box scrolls instantly.
- smoothThe scrolling box scrolls in a smooth fashion using a user-agent-defined easing function over a user-agent-defined period of time. User agents should follow platform conventions, if any.
Example
Browser Support
The following information will show you the current browser support for the CSS scroll-behavior property. Hover over a browser icon to see the version that first introduced support for this CSS property.
This property is supported by all modern browsers.
Desktop
Tablets & Mobile
Last updated by CSSPortal on: 1st January 2026
