CSS scroll-snap-align Property

❮ Previous Reference Next ❯

Example

.scroller > div {
  flex: 0 0 250px;
  width: 250px;
  background-color: #1A73E8;
  color: #fff;
  font-size: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  scroll-snap-align: start;
}





1
2
3

Meaning:

The scroll-snap-align CSS 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.

Default value:none
Inherited:No
Animatable:No
Version:CSS3
JavaScript syntax:
object.style.scrollSnapAlign="none|start|end|center|initial|inherit|revert|revert-layer|unset";



Standard Syntax

scroll-snap-align: none|start|end|center|initial|inherit|revert|revert-layer|unset;



Browser Support




Status







Property Values

The following table describes the values of this property:

Value Description
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.
initial Sets this property to its default value.
inherit If specified, the associated element takes the computed value of its parent element animation-delay property.
revert Reverts the cascaded value of the property from its current value to the value the property
revert-layer Rollback styles to the ones specified in previous cascade layers.
unset Resets a property to its inherited value if the property naturally inherits from its parent, and to its initial value if not.



Default CSS Property Values

selectors {
  scroll-snap-align: none;
}
❮ Previous Reference Next ❯