aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/css/scroll-margin-top/index.html
blob: 86a2719795c647a1d30a649cb6056ba93c07ec96 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
---
title: scroll-margin-top
slug: Web/CSS/scroll-margin-top
tags:
  - CSS
  - CSS Property
  - Reference
  - Web
  - scorll-margin
  - scroll-margin-top
translation_of: Web/CSS/scroll-margin-top
---
<div>{{CSSRef}}</div>

<p><code>scroll-margin-top</code> 属性定义了滚动捕捉区域的顶边距,用于在捕捉视口上捕捉该盒子。滚动捕捉区域是由变换后的边框决定的,找到它的矩形边界框(在滚动容器的坐标空间轴中轴对齐),然后添加指定的起始点。</p>

<div>{{EmbedInteractiveExample("pages/css/scroll-margin-top.html")}}</div>



<h2 id="Syntax" name="Syntax">语法</h2>

<pre class="brush: css notranslate">/* &lt;length&gt; values */
scroll-margin-top: 10px;
scroll-margin-top: 1em;

/* Global values */
scroll-margin-top: inherit;
scroll-margin-top: initial;
scroll-margin-top: unset;
</pre>

<h3 id="Values" name="Values"></h3>

<dl>
 <dt><code><var>&lt;length&gt;</var></code></dt>
 <dd>滚动容器顶部边缘的起点</dd>
</dl>

<h2 id="标准定义">标准定义</h2>

<p>{{cssinfo}}</p>

<h2 id="标准语法">标准语法</h2>

{{csssyntax}}

<h2 id="规范">规范</h2>

<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">规范</th>
   <th scope="col">状态</th>
   <th scope="col">注释</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{SpecName("CSS Scroll Snap Points", "#propdef-scroll-margin-top", "scroll-margin-top")}}</td>
   <td>{{Spec2("CSS Scroll Snap Points")}}</td>
   <td>Initial definition</td>
  </tr>
 </tbody>
</table>

<h2 id="浏览器兼容性">浏览器兼容性</h2>

<p class="hidden">The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p>

<p>{{Compat("css.properties.scroll-margin-top")}}</p>