Scroll-snap-align - CSS Property
Summary of characteristics of the scroll-snap-align property
none | start | center | endnoneDiscrète: during an animation, the scroll-snap-align property passes from one value to another without transition.Per grammar: serialization in the order of syntax.Syntax diagram of scroll-snap-align.
scroll-snap-align property.The links in the diagram provide more details about the values.
Download the diagram in SVG.
Description of the scroll-snap-align property.
The property scroll-snap-align operates within the context of scrolling with snapping (see our tutorial on scrolling with snaps).
It defines how the element that serves as a snap point should be aligned relative to the viewport.
scroll-snap-align is used on elements that serve as attachment points.
Also see the following properties:
Scroll Snap.Values for scroll-snap-align.
- scroll-snap-align: none;
The element is not considered a snap point. If no content element is defined as a snap point, scrolling will occur in the usual manner, without adjustment.
12345scroll-snap-align:none; - scroll-snap-align: start;
The start of the element aligns with the start of the viewport. The start of the element depends on the writing mode, depending on the language. See our explanations on writing modes.
So here is what thestartvalue corresponds to for the main languages.Horizontal scrolling scroll-snap-type:x;Vertical scrolling scroll-snap-type:y;Latin languages Left Top Arabic languages Right Top CJK langages Right Top Mongolian languages Left Top Hebrew Right Bottom In the examples below, the hooks are aligned to
start, so to the left for Latin languages, and to the right for Arabic languages (second example), althoughscroll-snap-alignis still set tostart.Latin languagesLatin languagesLatin languagesLatin languagesLatin languagesاللغة العربيةاللغة العربيةاللغة العربيةاللغة العربيةاللغة العربية - scroll-snap-align: end;
With the value
end, the end of the element aligns with the end of the viewport. Depending on the language, the valueendcorresponds to:Horizontal scrolling scroll-snap-type:x;Vertical scrolling scroll-snap-type:y;Latin languages Right Bottom Arabic languages Left Bottom CJK langages Left Bottom Mongolian languages Right Bottom Hebrew Left Top Latin languagesLatin languagesLatin languagesLatin languagesLatin languagesاللغة العربيةاللغة العربيةاللغة العربيةاللغة العربيةاللغة العربية - scroll-snap-align: center;
The center of the element aligns with the center of the viewport. This value is not dependent on the writing mode, as the center is the same regardless of the language.
12345 - scroll-snap-align: start center;
In principle, the syntax of
scroll-snap-alignexpects two values. This is necessary when it is necessary to distinguish the direction of the blocks (first value) from the direction of the lines (second value). When only one value is specified, it applies to both directions.The example below shows what happens with center alignment in the line direction (horizontal) and start alignment in the block direction (vertical).
A1A2A3A4A5B1B2B3B4B5C1C2C3C4C5D1D2D3D4D5E1E2E3E4E5 - scroll-snap-align: initial; (
none) scroll-snap-align: inherit; scroll-snap-align: revert; scroll-snap-align: revertLayer; scroll-snap-align: unset;See the following pages for more details:
initial,inherit,revert,revert-layer,unset.
Animation of the scroll-snap-align property.
The property scroll-snap-align can be animated. Its values being non-numeric, the property switches abruptly from one value to another.
Simulator.
To observe the effect of the scroll-snap-align property and its different values, scroll through the content using the scroll bar or the
mouse wheel on a PC, or by swiping on a touchscreen.
Browsers compatibility with scroll-snap-align.
Support for scroll-snap-align is good on all current browsers.
scroll-snap-align which defines whether the snap occurs at the start, center, or end of the element.scroll-snap-alignproperty
Browsers on computers :
Mobile browsers :
Outdated or marginal browsers :

Internet Explorer

UC Browser pour Androïd

Opéra Mobile

QQ Browser

Baidu Browser

Opéra

Samsung Internet

Firefox pour Androïd

Edge

Firefox

Chrome pour Androïd

Androïd Brower

Safari

Safari sur IOS

Chrome

KaiOS Browser

Opéra mini
Historic of the scroll-snap-align property.
-
CSS Scroll Snap Module - Level 1
This specification module defines the features regarding scrolling with snap positions. In other words, content-aligned scrolling, to prevent, for example, an image from being cut off at the top or bottom of its container.
Regardingscroll-snap-align. First introduction to thescroll-snap-alignproperty.March 26, 2015Working Draft.October 20, 2016Candidate Recommendation.
See also, regarding scrolling with snapping.
Scrolling with snapping is described in the CSS Scroll Snap Module. The property scroll-snap-align and all those related to the subject
are also present in this module.
Properties:
Scroll Snap.


