scroll-snap-align - CSS: Cascading Style Sheets 编辑
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.
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.
Safari currently has the two value syntax in the wrong order, the first value being inline the second block. See bug #191865.
Formal definition
Initial value | none |
---|---|
Applies to | all elements |
Inherited | no |
Computed value | as specified |
Animation type | discrete |
Formal syntax
[ none | start | end | center ]{1,2}
Specifications
Specification | Status | Comment |
---|---|---|
CSS Scroll Snap Module Level 1 The definition of 'scroll-snap-align' in that specification. | Candidate Recommendation | Initial definition |
Browser compatibility
BCD tables only load in the browser
See also
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论