Skip to content

Files

Latest commit

 

History

History
24 lines (20 loc) · 1.44 KB

82.md

File metadata and controls

24 lines (20 loc) · 1.44 KB
title date submitter number tags discussion
I want to create additional "author" sub-origins in the cascade
2019-11-01 20:44:00 UTC
Miriam Suzanne
82
css

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: w3c/csswg-drafts#4470