scroll-margin-top
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since January 2020.
scroll-margin-top
属性定义了滚动吸附区域的上外边距,此区域用于将此盒吸附至滚动口。滚动吸附区域的确定方法为:取变换后的边框盒,求其矩形包围盒(与滚动容器的坐标空间中的轴对齐),再加上指定的外边距。
尝试一下
语法
css
/* <length> 值 */
scroll-margin-top: 10px;
scroll-margin-top: 1em;
/* 全局值 */
scroll-margin-top: inherit;
scroll-margin-top: initial;
scroll-margin-top: revert;
scroll-margin-top: revert-layer;
scroll-margin-top: unset;
取值
<length>
-
滚动容器的上外边距。
形式定义
形式语法
scroll-margin-top =
<length>
规范
Specification |
---|
CSS Scroll Snap Module Level 1 # margin-longhands-physical |
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
scroll-margin-top |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- Partial support
- Partial support
- Uses a non-standard name.
- Has more compatibility info.
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.