Give the scroll container `scroll-snap-type: x mandatory` (horizontal) or `y mandatory` (vertical), and each item `scroll-snap-align: center` (or `start`). That's the whole API — the browser aligns wherever momentum scrolling ends to an item boundary.
So the first and last items can also reach the center of the viewport, add padding to the container roughly half an item's width on each side. Skip it and the edge items get stuck against the container's edge, looking out of alignment with the rest.
`mandatory` always comes to rest on a snap point; `proximity` only snaps when you land near one. If people flick through quickly a lot, `proximity` feels less rigid.
When to use
Use it for image galleries, onboarding slides, product carousels — any horizontal or vertical list meant to be viewed one item at a time.