Scroll Snap Reference

Core Properties

PropertyValuesApplied To
scroll-snap-typex|y|both + mandatory|proximityScroll container
scroll-snap-alignstart | center | end | noneScroll children
scroll-paddingpx | rem | % (shorthand or per side)Scroll container
scroll-marginpx | remScroll children
scroll-snap-stopnormal | alwaysScroll children
overscroll-behaviorauto | contain | noneScroll container

Horizontal Scroll Snap (scroll below)

Vertical Scroll Snap

Code Example

/* Horizontal carousel */ .carousel { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding: 0 16px; } .carousel-item { min-width: 80%; scroll-snap-align: start; scroll-snap-stop: always; } /* Vertical full-screen sections */ .sections { height: 100vh; overflow-y: scroll; scroll-snap-type: y mandatory; } .section { height: 100vh; scroll-snap-align: start; }