I want to create additional “author” sub-origins in the cascade
Submitted by Miriam Suzanne
Permalink https://webwewant.fyi/wants/82/
The first step of the cascade is to sort rules into layers of "origin & importance"—where rules in each layer override rules in the previous layer, regardless of specificity:
- user agent normal
- user normal
- author normal
- (animations)
- author
!important
- user
!important
- user agent
!important
We can use !important
to create a new author layer with extra-high specificity, but it's not generally a good idea and will override animations. The :where()
selector will allow zero-specificity selectors, which is also a step in the right direction, but I think there are many use-cases for defining "origin" layers like "resets" / "third-party tools" / "brand defaults" / "theme" / "patterns" / "components" - so that component styles override pattern styles and so on: a cascade of author origins.
The cascade is a powerful concept, and the foundation of CSS, but authors only have direct control over specificity and source order. This leads to specificity wars between different layers of the system that might share specificity, but have a clear division in terms of "origin" type.
Cross-posted to the CSS Working Group: https://github.com/w3c/csswg-drafts/issues/4470