CSS Scroll Snap Playground

Mrs. Yanti’s sliding display: set scroll-snap-type on the rail or the crates, snap-align and scroll-padding, push the rail, and the browser stops the scroll…

Why it matters

Carousels and galleries are everywhere, and they used to need a JS library. With scroll-snap the browser handles the momentum, the keyboard and the scroll accessibility; you only say where to stop.

The key idea

scroll-snap-type on the container, scroll-snap-align on the children

Common mistakes

Try it in this playground