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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
---
title: '-webkit-mask-attachment'
slug: Web/CSS/-webkit-mask-attachment
translation_of: Web/CSS/-webkit-mask-attachment
---
<div>{{CSSRef}}{{Non-standard_header}}</div>
<p id="Summary">如果使用了 {{Cssxref("-webkit-mask-image")}}, <code>-webkit-mask-attachment</code> 将指定蒙版在视口的位置是固定的,还是同包含块一起滚动的。</p>
<pre class="brush: css no-line-numbers">/* 关键字 */
-webkit-mask-attachment: scroll;
-webkit-mask-attachment: fixed;
-webkit-mask-attachment: local;
/* 多个值 */
-webkit-mask-attachment: scroll, local;
-webkit-mask-attachment: fixed, local, scroll;
/* 全局值 */
-webkit-mask-attachment: inherit;
-webkit-mask-attachment: initial;
-webkit-mask-attachment: unset;
</pre>
<p>{{cssinfo}}</p>
<h2 id="语法">语法</h2>
<h3 id="可用的值">可用的值</h3>
<dl>
<dt>scroll</dt>
<dd>使用 <code>scroll</code> 时, 蒙版在视口中同包含它的块一起滚动。</dd>
<dt>fixed</dt>
<dd><font face="Open Sans, arial, x-locale-body, sans-serif"><span style="background-color: #ffffff;">使用 </span></font><code>fixed</code> 时, 蒙版不会同包含它的元素一起滚动,而是在视口中固定不动。</dd>
</dl>
<h3 id="使用语法">使用语法</h3>
{{csssyntax}}
<h2 id="示例">示例</h2>
<pre class="brush: css">body {
-webkit-mask-image: url('images/mask.png');
-webkit-mask-attachment: fixed;
}
</pre>
<h2 id="浏览器兼容性">浏览器兼容性</h2>
<p>{{CompatibilityTable}}</p>
<div id="compat-desktop">
<table class="compat-table">
<tbody>
<tr>
<th>Feature</th>
<th>Chrome</th>
<th>Firefox (Gecko)</th>
<th>Internet Explorer</th>
<th>Opera</th>
<th>Safari</th>
</tr>
<tr>
<td>Basic support</td>
<td>{{CompatVersionUnknown}}<br>
{{CompatNo}} 24.0</td>
<td>{{CompatNo}}</td>
<td>{{CompatNo}}</td>
<td>{{CompatNo}}</td>
<td>4.0</td>
</tr>
</tbody>
</table>
</div>
<div id="compat-mobile">
<table class="compat-table">
<tbody>
<tr>
<th>Feature</th>
<th>Android</th>
<th>Firefox Mobile (Gecko)</th>
<th>IE Phone</th>
<th>Opera Mobile</th>
<th>Safari Mobile</th>
</tr>
<tr>
<td>Basic support</td>
<td>2.1</td>
<td>{{CompatNo}}</td>
<td>{{CompatNo}}</td>
<td>{{CompatNo}}</td>
<td>3.2</td>
</tr>
</tbody>
</table>
</div>
<h2 id="另见">另见</h2>
<p>{{cssxref("-webkit-mask")}}, {{cssxref("-webkit-mask-clip")}}, {{cssxref("-webkit-mask-box-image")}}, {{cssxref("-webkit-mask-origin")}}, {{cssxref("-webkit-mask-image")}}, {{cssxref("-webkit-mask-composite")}}, {{cssxref("-webkit-mask-repeat")}}</p>
|