The isolation
CSS property determines whether an element must create a new stacking context.
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.
This property is especially helpful when used in conjunction with mix-blend-mode
.
Syntax
/* Keyword values */ isolation: auto; isolation: isolate; /* Global values */ isolation: inherit; isolation: initial; isolation: unset;
The isolation
property is specified as one of the keyword values listed below.
Values
auto
- A new stacking context is created only if one of the properties applied to the element requires it.
isolate
- A new stacking context must be created.
Formal definition
Initial value | auto
|
Applies to | All elements. In SVG, it applies to container elements, graphics elements, and graphics referencing elements. |
Inherited | no |
Computed value | as specified |
Animation type | discrete |
Formal syntax
auto | isolate
Examples
Forcing a new stacking context for an element
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>
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;
}
Result
Specifications
Specification | Status | Comment |
---|---|---|
Compositing and Blending Level 1The definition of 'Isolation' in that specification. | Candidate Recommendation | Initial definition |
Browser compatibility
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
isolation
|
Chrome
Full support 41 |
Edge
Full support 79 |
Firefox
Full support 36 |
IE
No support No |
Opera
Full support 30 |
Safari
Full support 8 |
WebView Android
Full support 41 |
Chrome Android
Full support 41 |
Firefox Android
Full support 36 |
Opera Android
Full support 30 |
Safari iOS
Full support 8 |
Samsung Internet Android
Full support 4.0 |
Legend
- Full support
- Full support
- No support
- No support
See also
isolation by Mozilla Contributors is licensed under CC-BY-SA 2.5.