Re: Proposal: CSS `specificity` Property for Explicit Selector Weight

Hiya! Please note that most of our work takes place in our GitHub
repository <https://github.com/w3c/csswg-drafts/>; filing issues there
rather than in the mailing list makes them much less likely to be
accidentally forgotten about.

We've added a variety of specificity control mechanisms over the
years, most notably `:where()` (for setting the specificity of some
parts of the selector to 0), `@layer` (for separating rules entirely,
"above" regular specificity), and `@scope` (for resolving specificity
*ties* in favor of the "closer" scoping rule). You've cited all of
these in your "Prior Work" section.

Currently, we intend for those mechanisms to be the primary way
authors control their specificity. We've intentionally avoided, so
far, giving explicit control over the specificity of a selector,
because it's generally more readable and more maintainable to instead
use one of the above mechanisms (especially `@layer`). See the
`:where()` discussions in GitHub for some context there, where we
talked about the possibility of letting `:where()` explicitly set the
specificity (rather than always setting it to 0), and ended up
rejecting this.

~TJ

Received on Thursday, 14 August 2025 20:55:34 UTC