我們的志工尚未將本文翻譯為 正體中文 (繁體) 版本。加入我們,幫忙翻譯!
您也可以閱讀本文的 English (US) 版本。

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.

Initial valuenone
Applies toall elements
Inheritedno
Mediavisual
Computed valueas specified
Animation typediscrete
Canonical orderper grammar

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.

Formal syntax

[ none | start | end | center ]{1,2}

Safari currently has the two value syntax in the wrong order, the first value being inline the second block. See bug #191865.

Specification

Specification Status Comment
CSS Scroll Snap Module Level 1
The definition of 'scroll-snap-align' in that specification.
Candidate Recommendation Initial definition

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
scroll-snap-alignChrome Full support 69Edge No support NoFirefox No support NoIE No support NoOpera Full support 56Safari Full support 11WebView Android Full support 69Chrome Android Full support 69Edge Mobile No support NoFirefox Android No support NoOpera Android Full support 56Safari iOS Full support 11Samsung Internet Android No support No

Legend

Full support  
Full support
No support  
No support

文件標籤與貢獻者

此頁面的貢獻者: mdnwebdocs-bot, rachelandrew
最近更新: mdnwebdocs-bot,