scroll-margin-block shorthand property sets the scroll margins of an element in the block dimension.

The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.

组成特性

此特性是下列 CSS 特性的简写:

句法

/* <length> values */
scroll-margin-block: 10px;
scroll-margin-block: 1em .5em ;
/* Global values */
scroll-margin-block: inherit;
scroll-margin-block: initial;
scroll-margin-block: unset;
					

<length>

An outset from the corresponding edge of the scroll container.

描述

The scroll-margin values represent outsets defining the scroll snap area that is used for snapping this box to the snapport. The scroll snap area is determined by taking the transformed border box, finding its rectangular bounding box (axis-aligned in the scroll container’s coordinate space), then adding the specified outsets.

形式定义

初始值 0
适用于 所有元素
继承 no
计算值 如指定
动画类型 by computed value type

形式句法

<length>{1,2}
					

规范

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

浏览器兼容性

更新 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-margin-block Chrome 完整支持 69 Edge 完整支持 79 Firefox 完整支持 68 IE 不支持 No Opera 完整支持 56 Safari 不支持 No WebView Android 完整支持 69 Chrome Android 完整支持 69 Firefox Android 完整支持 68 Opera Android 完整支持 48 Safari iOS 不支持 No Samsung Internet Android 完整支持 10.0

图例

完整支持

完整支持

不支持

不支持

元数据

  • 最后修改: