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.

句法

/* 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;
					

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 .

形式定义

初始值 none
适用于 所有元素
继承 no
计算值 如指定
动画类型 discrete

形式句法

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

规范

规范 状态 注释
CSS Scroll Snap Module Level 1
The definition of 'scroll-snap-align' in that specification.
候选推荐 初始定义

浏览器兼容性

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. 更新 GitHub 上的兼容性数据
Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
scroll-snap-align Chrome 完整支持 69 Edge 完整支持 79 Firefox 完整支持 68 IE 不支持 No Opera 完整支持 56 Safari 完整支持 11 WebView Android 完整支持 69 Chrome Android 完整支持 69 Firefox Android 完整支持 68 Opera Android 完整支持 48 Safari iOS 完整支持 11 Samsung Internet Android 完整支持 10.0

图例

完整支持

完整支持

不支持

不支持

元数据

  • 最后修改: