Re: [csswg-drafts] [css-cascade-5] Allow authors to explicitly place unlayered styles in the cascade layer order (#6323)

> [#](https://github.com/w3c/csswg-drafts/issues/6323#issuecomment-1800349286) The solution to unlayered styles might just be… layering those styles?

Yes, but if you old browser doesn’t understand layers, you’re screwed and you end up with no styles at all.

> [#](https://github.com/w3c/csswg-drafts/issues/6323#issuecomment-1800349286) Can I as a masto admin override what Mastodon provides as part of their app? Which… I'm not sure if that makes sense as a CSS feature? Isn't that a feature request on the applications themselves?

Problem is when your application – be it Masto, WordPress, or whatever – does not use layers, you are prevented from using layers at all to add some extra overrides. You **must** use unlayered styles from that point on.

---

Personally, what I’d love to see is a simple way to say _“this is a layer, **but it wins from unlayered styles**”_. No need to reorder any existing ones or finely control where the unlayered styles should go.

In some thread about `@scope` I floated around the idea of adding a `!` to the at-rule itself, to indicate that it’s a strong one. For layers, this would be `@layer!`. These would stack on top of unlayered styles, using the same layer logic for determining the order and what not.


E.g. 

```css
@layer! a, b, c;
@layer d, e, f;

@layer! g { … }
@layer h { … }
```

… would leave you with this order _(ranked from high priority to low priority)_: g, c, b, a, _unlayered_, h, f, e, d.

-- 
GitHub Notification of comment by bramus
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6323#issuecomment-1803998022 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 9 November 2023 15:01:02 UTC