scroll-initial-target
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The scroll-initial-target CSS property enables the definition of elements that are potential snap targets when their ancestor scroll container is first rendered.
Browser support
| Feature | Desktop | Mobile | ||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Safari | Chrome Android | Safari iOS | |
scroll-initial-target Experimental | 133 | 133 | | | 133 | |
nearest Experimental | 133 | 133 | | | 133 | |
none Experimental | 133 | 133 | | | 133 | |
1+Supported (version) Not supported ※Has note Sub-feature descriptions sourced from MDN Web Docs (CC BY-SA 2.5)
Syntax
CSS
.latest-message {
scroll-initial-target: nearest;
}
.scroll-container {
overflow-y: auto;
} Live demo
Use cases
-
Use scroll-initial-target
Use scroll-initial-target when the default CSS behavior is not expressive enough for the component or layout you are building.
-
Handle edge cases
Apply scroll-initial-target to solve a specific styling constraint without introducing broader layout or behavior changes.
Cautions
- Test scroll-initial-target in the browsers you support, especially if it changes layout, text handling, or interaction behavior.
- Plan a fallback or acceptable degradation path when support is still limited.
Accessibility
- Confirm that using scroll-initial-target does not make content harder to perceive, understand, or operate in assistive contexts.