scroll-margin-block

简写属性 scroll-margin-block 设置了元素的块向滚动外边距。

尝试一下

属性构成

此属性为下列 CSS 属性的简写属性:

语法

css
/* <length> 值 */
scroll-margin-block: 10px;
scroll-margin-block: 1em 0.5em;

/* 全局值 */
scroll-margin-block: inherit;
scroll-margin-block: initial;
scroll-margin-block: revert;
scroll-margin-block: revert-layer;
scroll-margin-block: unset;

取值

<length>

滚动容器对应边的外边距。

描述

scroll-margin 值表示定义滚动吸附区域的外边距,此区域用于将此盒吸附至滚动口。滚动吸附区域的确定方法为:取变换后的边框盒,求其矩形包围盒(与滚动容器的坐标空间中的轴对齐),再加上指定的外边距。

形式定义

初始值as each of the properties of the shorthand:
适用元素all elements
是否是继承属性
计算值as each of the properties of the shorthand:
Animation typeby computed value type

形式语法

scroll-margin-block = 
<length>{1,2}

规范

Specification
CSS Scroll Snap Module Level 1
# propdef-scroll-margin-block

浏览器兼容性

BCD tables only load in the browser

参见