scroll-margin-top
属性定义了滚动捕捉区域的顶边距,用于在捕捉视口上捕捉该盒子。滚动捕捉区域是由变换后的边框决定的,找到它的矩形边界框(在滚动容器的坐标空间轴中轴对齐),然后添加指定的起始点。
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.
语法
/* <length> values */
scroll-margin-top: 10px;
scroll-margin-top: 1em;
/* Global values */
scroll-margin-top: inherit;
scroll-margin-top: initial;
scroll-margin-top: unset;
值
<length>
- 滚动容器顶部边缘的起点
标准定义
标准语法
规范
规范 | 状态 | 注释 |
---|---|---|
CSS Scroll Snap Module Level 1 scroll-margin-top |
Candidate Recommendation | Initial definition |
浏览器兼容性
BCD tables only load in the browser
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.