@ Working Draft
Cascade & Inheritance Level 6 defines scoped styles – allowing authors to provide bounded ranges for selector-matching, and give priority to more ‘proximate’ scope origins.
Specification for Scoped Styles
Bookmark from W3C CSS Working Group
There are many overlapping and sometimes contradictory features that can live under the concept of “scope” in CSS – but they divide roughly into two approaches:
That has lead to a wide range of proposals over the years, including an old scope specification that was never implemented. Focus moved to Shadow-DOM, which is mainly concerned with approach #1 – full isolation. Meanwhile authors have attempted to handle approach #2 through convoluted naming conventions (like BEM) and JS tooling (such as CSS Modules, Styled Components, & Vue Scoped Styles).
In Cascade Level 6 we are developing a new native CSS approach to scope.
A prototype of @scope
is available in Chrome Canary
with the Experimental Web Platform Features flag enabled.
– » talk
» elsewhere @ 12 Days of Web
» podcast @ Shop Talk Show
– » talk
» podcast @ PodRocket
» podcast @ Morten Rand-Hendriksen
– » talk
» podcast @ Front End Nerdery
» podcast @ Syntax.fm
» podcast @ Word Wrap Show
» podcast @ The F-Word
– » talk
» spec @ W3C CSS Working Group