- From: Emilio Cobos Álvarez via GitHub <noreply@w3.org>
- Date: Tue, 29 Jul 2025 11:23:16 +0000
- To: public-css-archive@w3.org
But can't you do that with something like this at the top level?
```css
@custom-media --foo ((screen) and (...)) or ((print) and ...);
```
I guess not because `screen` and `print` are media-types, so you'd need two separate queries (`--foo-screen` and `--foo-print` or so?). That seems something that if needed we could easily lift if needed.
But yeah it's a good point that conditional stylesheets make this harder... To be fair, what I don't want is having to overcomplicate how we process stylesheets so that we need multiple passes, since that's already fairly hot code for pageload.
I wonder if an alternative is saying that `@custom-media`s don't apply "backwards", e.g.:
```css
@custom-media --foo ...;
@media (--foo) {
/* This uses the `--foo` from above, not the one below */
}
@media (--bar) {
/* This never applies, `--bar` is not defined */
}
@custom-media --foo ...;
@media (--foo) {
/* This uses the second `--foo` media */
}
@custom-media --bar ...;
@media (--bar) {
/* This one works */
}
```
--
GitHub Notification of comment by emilio
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/12536#issuecomment-3132011705 using your GitHub account
--
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Tuesday, 29 July 2025 11:23:17 UTC