- From: François REMY via GitHub <sysbot+gh@w3.org>
- Date: Wed, 02 Feb 2022 23:28:08 +0000
- To: public-css-archive@w3.org
Hi @bramus,
Having layered styles always win is not going to make your site work in browsers that don't support layer if you don't do anything, I fail to see how this would be of any use at all to fix the Progressive Enhancement problem. All styles must work for a site to work, not just some.
There is no other solution, eople who want to use `@layer` today can, as long as they use a (compile-time) polyfill.
Here is the conversion that is required:
```css
/* this style will win even if this is the first h1 because it's unlayered */
h1.main { color: green; }
/* these styles are like defaults */
@layer x {
article > h1:first-child { color: red; }
h1 { color: blue; }
}
```
=>
```css
/* layer styles must come first, with :where so they have no specificity and get overriden by all other styles */
/* this means that the rules have to be sorted by specificity per layer, otherwise this won't work */
/* these styles are like defaults */
:where(h1) { color: blue; }
:where(article > h1:first-child) { color: red; }
/* unlayered styles can come in regular order, after the unlayered styles */
/* this style will win even if this is the first h1 because it's unlayered */
h1.main { color: green; }
```
--
GitHub Notification of comment by FremyCompany
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6323#issuecomment-1028454797 using your GitHub account
--
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Wednesday, 2 February 2022 23:28:10 UTC