diff options
Diffstat (limited to 'files/zh-cn/web/css/isolation/index.html')
-rw-r--r-- | files/zh-cn/web/css/isolation/index.html | 156 |
1 files changed, 156 insertions, 0 deletions
diff --git a/files/zh-cn/web/css/isolation/index.html b/files/zh-cn/web/css/isolation/index.html new file mode 100644 index 0000000000..ad3c297a5f --- /dev/null +++ b/files/zh-cn/web/css/isolation/index.html @@ -0,0 +1,156 @@ +--- +title: isolation +slug: Web/CSS/isolation +tags: + - CSS + - CSS参考 + - CSS属性 + - CSS混合 + - 布局 +translation_of: Web/CSS/isolation +--- +<p>{{CSSRef()}}</p> + +<h2 id="Summary" name="Summary">概述</h2> + +<p><code>isolation</code> CSS属性定义该元素是否必须创建一个新的层叠上下文({{glossary("stacking context")}})。</p> + +<p>该属性的主要作用是当和{{cssxref("background-blend-mode")}}属性一起使用时,可以只混合一个指定元素栈的背景:它允许使一组元素从它们后面的背景中独立出来,只混合这组元素的背景。</p> + +<p>{{cssinfo}}</p> + +<h2 id="Syntax" name="Syntax">语法</h2> + +<pre class="twopartsyntaxbox"><code>Formal syntax: {{csssyntax("isolation")}}</code></pre> + +<pre>isolation: auto; +isolation: isolate; + +isolation: initial; +isolation: inherit; +isolation: unset; +</pre> + +<h3 id="Values" name="Values">值</h3> + +<dl> + <dt><code>auto</code></dt> + <dd>该关键字定义只有在该元素的属性需要的时候才会创建一个新的元素栈环境。</dd> + <dt><code>isolate</code></dt> + <dd>该关键字定义一个新的元素栈环境会被创建。</dd> +</dl> + +<h2 id="示例">示例</h2> + +<pre class="brush: html"><div id="b" class="a"> + <div id="d"> + <div class="a c">auto</div> + </div> + <div id="e"> + <div class="a c">isolate</div> + </div> +</div> +</pre> + +<pre class="brush: css">.a { + background-color: rgb(0,255,0); +} +#b { + width: 200px; + height: 210px; +} +.c { + width: 100px; + height: 100px; + border: 1px solid black; + padding: 2px; + mix-blend-mode: difference; +} +#d { + isolation: auto; +} +#e { + isolation: isolate; +}</pre> + +<p>{{ EmbedLiveSample('%E7%A4%BA%E4%BE%8B', "230", "230") }}</p> + +<h2 id="Examples" name="Examples">规范</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', '#isolation', 'Isolation') }}</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> + <p class="p1">{{CompatChrome(41.0)}}</p> + </td> + <td>{{CompatGeckoDesktop('36')}}</td> + <td>{{CompatNo()}}</td> + <td>{{CompatUnknown()}}</td> + <td>{{CompatUnknown()}}</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> + <p class="p1">{{CompatChrome(41.0)}}</p> + </td> + <td>{{CompatGeckoMobile('36')}}[1]</td> + <td>{{CompatNo()}}</td> + <td>{{CompatUnknown()}}</td> + <td>{{CompatUnknown()}}</td> + </tr> + </tbody> +</table> +</div> + +<h2 id="See_also" name="See_also">参见</h2> + +<ul> + <li>{{cssxref("<blend-mode>")}}</li> + <li>{{cssxref("mix-blend-mode")}}, {{cssxref("background-blend-mode")}}</li> +</ul> |