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 valuenone
Applies toall elements
Inheritedno
Computed valueas specified
Animation typediscrete

Formal syntax

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

Specifications

SpecificationStatusComment
CSS Scroll Snap Module Level 1
The definition of 'scroll-snap-align' in that specification.
Candidate RecommendationInitial definition

Browser compatibility

BCD tables only load in the browser

See also

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:115 次

字数:4672

最后编辑:7年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文