Re: [csswg-drafts] [css-cascade-5] Reconsider placement of unlayered styles, for better progressive enhancement? (#6284)

I represent the AMP library, and wanted to chime in that we believe the decision to revert this was the correct choice. AMP wants to provide a set of default styles as a framework that end users can then add their own styles on top of. We've had issues in past where changing a selector in anyway causes it to become more specific than the end user's selector, and now our default styles are overriding their intended styles.

We're looking to use `@layer` to solve this, so that all of our styles are truly defaults and any unlayered end user styles will  override our `@layer` styles. We fully expect our end users to continue to write unlayered styles just out of habit. Now we can be free to make our `@layer` selectors extremely specific without worrying that we'll win over the end user's selector.


```css
@layer AMP {
  amp-foo p {
    /* This default style should be easy to override */
    color: red;
    font-size: 100px;
  }
}

/* End users will write unlayered out of habit */
p {
  /* This should win, even though `p` is less specific than `amp-foo p` */
  color: green;
}
```

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


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

Received on Thursday, 6 January 2022 21:26:40 UTC