scroll-snap-align
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2019.
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 snap port (as the alignment container).
Try it
Syntax
/* Single keyword value */
scroll-snap-align: none;
scroll-snap-align: center;
scroll-snap-align: start;
scroll-snap-align: end;
/* Two keyword values */
scroll-snap-align: start end;
scroll-snap-align: end center;
scroll-snap-align: center start;
/* Global values */
scroll-snap-align: inherit;
scroll-snap-align: initial;
scroll-snap-align: revert;
scroll-snap-align: revert-layer;
scroll-snap-align: unset;
Values
One or two values can be specified for the scroll-snap-align
property. If one value is set, it is applied to both the block and inline axes. If two values are set, the first value controls the block axis and the second value controls the inline axis.
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.
Formal definition
Initial value | none |
---|---|
Applies to | all elements |
Inherited | no |
Computed value | as specified |
Animation type | discrete |
Formal syntax
Specifications
Specification |
---|
CSS Scroll Snap Module Level 1 # scroll-snap-align |
Browser compatibility
BCD tables only load in the browser