CSS の isolation
プロパティは、要素が新しい重ね合わせコンテキストを生成する必要があるかどうかを定義します。
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.
このデモのソースファイルは GitHub リポジトリに格納されています。デモプロジェクトに協力したい場合は、 https://github.com/mdn/interactive-examples をクローンしてプルリクエストを送信してください。
このプロパティは mix-blend-mode
との組み合わせで使用すると特に有用です。
構文
/* キーワード値 */
isolation: auto;
isolation: isolate;
/* グローバル値 */
isolation: inherit;
isolation: initial;
isolation: unset;
isolation
プロパティは、以下の一覧にあるキーワード値のうちの一つで指定します。
値
auto
- 何れかのプロパティが必要な要素に適用された場合にのみ、新しい重ね合わせコンテキストが作成されます。
isolate
- 新しい重ね合わせコンテキストが必ず作成されます。
形式文法
auto | isolate
例
<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>
.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;
}
仕様書
仕様書 | 状態 | 備考 |
---|---|---|
Compositing and Blending Level 1 Isolation の定義 |
勧告候補 | Initial definition |
初期値 | auto |
---|---|
適用対象 | すべての要素。 SVG では、コンテナー要素、グラフィック要素、グラフィック参照要素に適用されます。 |
継承 | なし |
計算値 | 指定通り |
アニメーションの種類 | 離散値 |
ブラウザーの対応
BCD tables only load in the browser