at-rule
@scope — CSS reference
Limits style-rule matching to a scope subtree, optionally excluding subtrees rooted at a scope limit. The prelude does not add selector specificity. Scope proximity can resolve otherwise tied rules; inheritance can still carry values across a scope boundary. Do not confuse scope with Shadow DOM isolation.
Formal Syntax & Structure
css syntaxcss
@scope (.panel) to (.nested) { p { color: teal; } }Working Example
Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>CSS reference lab</title><style>p {color:#184168} @scope (.panel) to (.nested) {p {color:#006050}}</style><body><div class="panel"><p id="a">Included</p><div class="nested"><p id="b">Excluded</p></div></div><p id="c">Outside</p></body></html>