I want to create additional "author" sub-origins in the cascade #95
aarongustafson
started this conversation in
Wants
Replies: 1 comment
-
Hello, I think you might be interested to hear about CSS Layers. It is currently experimental, but it would enable what I believe you are asking for, among other use-cases. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
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:
!important
!important
!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: w3c/csswg-drafts#4470
https://webwewant.fyi/wants/82/
Beta Was this translation helpful? Give feedback.
All reactions