concept

Style containment — CSS reference

Style containment scopes certain effects such as counters and quotes to a subtree. It does not prevent selectors from matching descendants, does not stop inheritance and is not a substitute for Shadow DOM. This test verifies inheritance and selector matching, not the entire counter algorithm.

Formal Syntax & Structure

css syntaxcss
contain: style;

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>style-containment</title><style>body{margin:0}#a{padding:8px;background:rgb(232,237,241);color:rgb(0,0,0);box-sizing:border-box}#box{contain:style;color:rgb(0,100,0)}</style><body><section id="box"><div id="child" style="width:100px;height:60px">Content</div></section></body></html>
CSS Reference