The scroll-snap-align
property specifies the boxโs snap position as an alignment of its snap area (as the alignment subject) within its snap containerโs snapport (as the alignment container). The two values specify the snapping alignment in the block axis and inline axis, respectively. If only one value is specified, the second value defaults to the same value.
Syntax
/* Keyword values */ scroll-snap-align: none; scroll-snap-align: start end; /* when two values set first is block, second inline */ scroll-snap-align: center; /* Global values */ scroll-snap-align: inherit; scroll-snap-align: initial; scroll-snap-align: unset;
Values
none
- The box does not define a snap position in that axis.
start
- The start alignment of this box's scroll snap area, within the scroll container's snapport is a snap position in this axis.
end
- The end alignment of this box's scroll snap area, within the scroll container's snapport is a snap position in this axis.
center
- The center alignment of this box's scroll snap area, within the scroll container's snapport is a snap position in this axis.
Safari currently has the two value syntax in the wrong order, the first value being inline the second block. See bug #191865.
Formal definition
Initial value | none |
---|---|
Applies to | all elements |
Inherited | no |
Computed value | as specified |
Animation type | discrete |
Formal syntax
[ none | start | end | center ]{1,2}
Specifications
Specification | Status | Comment |
---|---|---|
CSS Scroll Snap Module Level 1 The definition of 'scroll-snap-align' in that specification. |
Candidate Recommendation | Initial definition |
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
scroll-snap-align | Chrome Full support 69 | Edge Full support 79 | Firefox Full support 68 | IE No support No | Opera Full support 56 | Safari Full support 11 | WebView Android Full support 69 | Chrome Android Full support 69 | Firefox Android Full support 68 | Opera Android Full support 48 | Safari iOS Full support 11 | Samsung Internet Android Full support 10.0 |
Legend
- Full support
- Full support
- No support
- No support