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/background-blend-mode | |
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/background-blend-mode')
-rw-r--r-- | files/zh-cn/web/css/background-blend-mode/index.html | 149 |
1 files changed, 149 insertions, 0 deletions
diff --git a/files/zh-cn/web/css/background-blend-mode/index.html b/files/zh-cn/web/css/background-blend-mode/index.html new file mode 100644 index 0000000000..0a56ddcfa5 --- /dev/null +++ b/files/zh-cn/web/css/background-blend-mode/index.html @@ -0,0 +1,149 @@ +--- +title: background-blend-mode +slug: Web/CSS/background-blend-mode +translation_of: Web/CSS/background-blend-mode +--- +<p>{{CSSRef()}}</p> + +<h2 id="Summary" name="Summary">概述</h2> + +<p><code>background-blend-mode</code> CSS属性定义该元素的背景图片,以及背景色如何混合。</p> + +<p>混合模式应该按{{cssxref("background-image")}} CSS属性同样的顺序定义。如果混合模式数量与背景图像的数量不相等,它会被截取至相等的数量。</p> + +<p>{{cssinfo}}</p> + +<h2 id="Syntax" name="Syntax">语法</h2> + +<pre class="twopartsyntaxbox"><code>Formal syntax: {{csssyntax("background-blend-mode")}}</code></pre> + +<pre>/* 单值 */ +background-blend-mode: normal; + +/* 双值,每个背景一个值 */ +background-blend-mode: darken, luminosity; + +background-blend-mode: initial; +background-blend-mode: inherit; +background-blend-mode: unset; +</pre> + +<h3 id="Values" name="Values"><span style="font-style: inherit;">值</span></h3> + +<h3 id="Values" name="Values"><span style="font-family: consolas,monaco,andale mono,monospace; font-size: 14px; font-style: inherit; line-height: 1.5;"><blend-mode></span></h3> + +<dl> + <dd>一个{{cssxref("<blend-mode>")}}定义混合的模式,可以有多个值,用逗号间隔。</dd> +</dl> + +<h2 id="Examples" name="Examples">示例</h2> + +<pre class="brush: html" style="display: none;"><div id="div"></div> +<select id="select"> + <option>normal</option> + <option>multiply</option> + <option selected>screen</option> + <option>overlay</option> + <option>darken</option> + <option>lighten</option> + <option>color-dodge</option> + <option>color-burn</option> + <option>hard-light</option> + <option>soft-light</option> + <option>difference</option> + <option>exclusion</option> + <option>hue</option> + <option>saturation</option> + <option>color</option> + <option>luminosity</option> +</select></pre> + +<pre class="brush: css" style="display: none;">#div { + width: 300px; + height: 300px; + background: url('https://mdn.mozillademos.org/files/8543/br.png'),url('https://mdn.mozillademos.org/files/8545/tr.png'); + background-blend-mode: screen; +}</pre> + +<pre class="brush: js" style="display: none;">document.getElementById("select").onchange = function(event) { + document.getElementById("div").style.backgroundBlendMode = document.getElementById("select").selectedOptions[0].innerHTML; +} +console.log(document.getElementById('div'));</pre> + +<p>{{ EmbedLiveSample('Examples', "330", "330") }}</p> + +<h2 id="Specifications" name="Specifications">规范</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('Compositing', '#background-blend-mode', 'background-blend-mode') }}</td> + <td>{{ Spec2('Compositing') }}</td> + <td>首次定义</td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility" name="Browser_compatibility">浏览器兼容性</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>35</td> + <td>{{CompatGeckoDesktop('30.0')}}</td> + <td>{{CompatNo()}}</td> + <td>22</td> + <td>7.1</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 Mobile</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatNo()}}</td> + <td>{{CompatGeckoMobile('30.0')}}</td> + <td>{{CompatNo()}}</td> + <td>22</td> + <td>iOS 8</td> + </tr> + </tbody> +</table> +</div> + +<h2 id="See_also" name="See_also">参见</h2> + +<ul> + <li>{{cssxref("<blend-mode>")}}</li> + <li>{{cssxref("mix-blend-mode")}}</li> +</ul> |