diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/css/mask-image/index.html | |
parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip |
initial commit
Diffstat (limited to 'files/zh-cn/web/css/mask-image/index.html')
-rw-r--r-- | files/zh-cn/web/css/mask-image/index.html | 183 |
1 files changed, 183 insertions, 0 deletions
diff --git a/files/zh-cn/web/css/mask-image/index.html b/files/zh-cn/web/css/mask-image/index.html new file mode 100644 index 0000000000..cb3e1ce5d3 --- /dev/null +++ b/files/zh-cn/web/css/mask-image/index.html @@ -0,0 +1,183 @@ +--- +title: mask-image +slug: Web/CSS/mask-image +translation_of: Web/CSS/mask-image +--- +<div>{{CSSRef}}{{SeeCompatTable}}</div> + +<h2 id="概要">概要</h2> + +<p><strong><code>mask-image</code></strong> <a href="/en-US/docs/Web/CSS">CSS</a>属性用于设置元素上遮罩层的图像。</p> + +<p>{{cssinfo}}</p> + +<h2 id="语法">语法</h2> + +<pre class="brush:css">/* Keyword value */ +mask-image: none; + +/* <mask-source> value */ +mask-image: url(masks.svg#mask1); + +/* <image< values */ +mask-image: linear-gradient(rgba(0, 0, 0, 1.0), transparent); +mask-image: image(url(mask.png), skyblue); + +/* Multiple values */ +mask-image: image(url(mask.png), skyblue), linear-gradient(rgba(0, 0, 0, 1.0), transparent); + +/* Global values */ +mask-image: inherit; +mask-image: initial; +mask-image: unset; +</pre> + +<h3 id="Values">Values</h3> + +<dl> + <dt><code>none</code></dt> + <dd>默认值,透明的黑色图像层,也就是没有遮罩层。</dd> + <dt><code><mask-source></code></dt> + <dd><code><mask></code>或CSS图像的url</dd> + <dd>{{cssxref("<image>")}}</dd> + <dd>图片作为遮罩层</dd> +</dl> + +<h3 id="Formal_syntax">Formal syntax</h3> + +<pre class="syntaxbox">{{csssyntax}}</pre> + +<h2 id="例子">例子</h2> + +<h3 id="CSS">CSS</h3> + +<pre class="brush: css; highlight[5]">#masked { + width: 100px; + height: 100px; + background-color: #8cffa0; + mask-image: url(https://mdn.mozillademos.org/files/12676/star.svg); + -webkit-mask-image: url(https://mdn.mozillademos.org/files/12676/star.svg); +} +</pre> + +<h3 id="HTML">HTML</h3> + +<pre class="brush: html"><div id="masked"></div> +</pre> + +<p>{{EmbedLiveSample('例子', '100px', '100px')}}</p> + +<h2 id="Specifications">Specifications</h2> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{SpecName("CSS Masks", "#the-mask-image", "mask-image")}}</td> + <td>{{Spec2("CSS Masks")}}</td> + <td>Initial definition</td> + </tr> + </tbody> +</table> + +<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>Edge</th> + <th>Opera</th> + <th>Safari (WebKit)</th> + </tr> + <tr> + <td>Basic support</td> + <td>1.0{{property_prefix("-webkit")}}<sup>[1]</sup></td> + <td>{{CompatNo}}<sup>[2]</sup></td> + <td>{{CompatNo}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatVersionUnknown}}{{property_prefix("-webkit")}}</td> + <td>4.0{{property_prefix("-webkit")}}<sup>[3]</sup></td> + </tr> + <tr> + <td>Multiple mask images</td> + <td>1.0{{property_prefix("-webkit")}}</td> + <td>{{CompatNo}}<sup>[2]</sup></td> + <td>{{CompatNo}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatVersionUnknown}}{{property_prefix("-webkit")}}</td> + <td>4.0{{property_prefix("-webkit")}}</td> + </tr> + <tr> + <td>SVG masks</td> + <td>8.0</td> + <td>{{CompatNo}}<sup>[2]</sup></td> + <td>{{CompatNo}}</td> + <td>{{CompatUnknown}}</td> + <td>{{CompatVersionUnknown}}{{property_prefix("-webkit")}}</td> + <td>4.0{{property_prefix("-webkit")}}</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{{property_prefix("-webkit")}}<sup>[4]</sup></td> + <td>{{CompatNo}}<sup>[2]</sup></td> + <td>{{CompatUnknown}}</td> + <td>{{CompatNo}}</td> + <td>3.2{{property_prefix("-webkit")}}<sup>[5]</sup></td> + </tr> + <tr> + <td>Multiple mask images</td> + <td>{{CompatVersionUnknown}}{{property_prefix("-webkit")}}</td> + <td>{{CompatNo}}<sup>[2]</sup></td> + <td>{{CompatUnknown}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatVersionUnknown}}{{property_prefix("-webkit")}}</td> + </tr> + <tr> + <td>SVG masks</td> + <td>{{CompatVersionUnknown}}{{property_prefix("-webkit")}}</td> + <td>{{CompatNo}}<sup>[2]</sup></td> + <td>{{CompatUnknown}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatVersionUnknown}}{{property_prefix("-webkit")}}</td> + </tr> + </tbody> +</table> +</div> + +<p>[1] Implemented in version 8.0, Chrome initially only supported the <code>-webkit</code> prefixed versions of gradients as values. Later, support for the unprefixed versions was added.</p> + +<p>[2] This feature is not implemented yet. It is only available in Nightly and Dev Edition. See {{bug("1251161")}}.</p> + +<p>[3] Implemented in version 4.0, Safari initially only supported the <code>-webkit</code> prefixed versions of gradients as values.</p> + +<p>[4] Android initially only supported the <code>-webkit</code> prefixed versions of gradients as values.</p> + +<p>[5] iOS Safari initially only supported the <code>-webkit</code> prefixed versions of gradients as values.</p> |