pseudo-class

:scope — CSS reference

Represents a scoping root in a selector context. In element.querySelectorAll(), :scope can anchor a relative relationship to the element receiving the call. In an ordinary document stylesheet without other scoping, it represents the root element.

Formal Syntax & Structure

css syntaxcss
:scope

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>CSS reference lab</title><style>#a,#b {color:#202020} :scope {color:#006050}</style><body><section id="a"><p class="item">Direct</p><div><p class="item">Nested</p></div></section><p id="b">Outside</p></body></html>
CSS Reference