Scroll snap

Also called CSS scroll snap or snap scrolling

A CSS feature that makes a scroll container settle on set points, so carousels and full-screen sections come to rest neatly on an item.

What is Scroll snap?

Scroll snap lets the browser finish a scroll for you. Swipe a carousel and let go, and it glides to the nearest card, lined up with the edge. It works with touch, trackpads, mouse wheels, and the keyboard, and keeps the natural momentum of each device.

Two properties do the work. On the scroll container, scroll-snap-type: x mandatory turns on snapping along the horizontal axis. On each child, scroll-snap-align: start (or center) marks where it lines up. Add scroll-padding to the container when a header or page margin should stay clear.

Use mandatory for carousels and galleries where every stop should land on an item, and proximity for long pages where snapping should only kick in near a snap point. Let part of the next item peek in so people know there is more, and keep items focusable for keyboard users.

Often confused with

Carousel
A carousel is the component that shows items in a sideways row. Scroll snap is a CSS technique that makes a carousel come to rest on each item.
All terms

Carousel

A row of slides shown one at a time and moved with arrows, dots, swipes, or a timer, to fit several images or cards in one spot.

Smooth scrolling

Animated scrolling that glides to a new position, such as the target of an anchor link, so readers can see where on the page they went.

Horizontal scroll section

A pinned section where scrolling down moves a row of cards sideways, turning vertical scrolling into horizontal movement.

Momentum

The glide an element keeps after a throw or flick, slowing down gradually like an object sliding across a smooth table.