CKTIS / CSS
scroll-snap-type — scroll snapping
This property selects snapping axes and strictness on a scroll container; scroll-snap-align defines the target positions.
Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
Syntax
scroll-snap-type: none | [ x | y | block | inline | both | pair ] [ mandatory | proximity ]?;scroll-snap-type applies to a scroll container. Initially none disables snapping; the property is not inherited. Scrollable content and positions defined through scroll-snap-align are needed.
x/y mean horizontal/vertical axes; block/inline depend on writing mode. both evaluates axes independently; pair combines them into a point from one area aligned in both axes. Inclusion of pair in the draft does not establish browser support.
Omitting strictness defaults to proximity, leaving snapping discretionary. mandatory requires a valid resting position after scrolling, if one exists. Widely separated targets can obstruct access to intervening content.
Examples
<!doctype html>
<meta charset="utf-8">
<title>scroll-snap-type</title>
<style>
.scroller {
display: flex;
width: 240px;
overflow-x: auto;
scroll-snap-type: x mandatory;
}
.scroller > div {
flex: 0 0 240px;
height: 120px;
scroll-snap-align: start;
background: #def;
}
.scroller > div:nth-child(2) { background: #fed; }
</style>
<div class="scroller" tabindex="0" role="region" aria-label="Scroll snap demo">
<div>1</div><div>2</div><div>3</div>
</div>Result
Expected resting scrollLeft values: 0, 240, 480 CSS px.
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.