property
Scroll snap align — CSS reference
Aligns the target snap area with the snapport at start, center or end; none removes its snap position. Two values select block then inline alignment.
Formal Syntax & Structure
css syntaxcss
scroll-snap-align: start;Working Example
Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>scroll-snap-align</title><style>body{margin:0}#a{padding:8px;background:rgb(232,237,241);color:rgb(0,0,0);box-sizing:border-box}#s{width:100px;height:90px;overflow-x:auto;scroll-snap-type:x mandatory}#strip{display:flex;width:400px}#strip>div{flex:0 0 100px;height:65px;box-sizing:border-box;scroll-snap-align:start;border:1px solid #777;padding:0}</style><body><div id="s" tabindex="0" aria-label="Snap carousel"><div id="strip"><div>One</div><div id="a">Two</div><div>Three</div><div>Four</div></div></div><button id="go">Scroll toward item three</button><script>document.querySelector("#go").onclick=()=>document.querySelector("#s").scrollTo({left:175,behavior:"instant"});</script></body></html>