Re: [csswg-drafts] Defining `@custom-media` inside conditional at-rules (#12536)

That seems worse :)

I think this kind of behavior would be surprising to authors because they expect the last definition (taking into account source order, cascade layers, ...) to have effect.

----

You can write:

```css
@custom-media --foo-print-medium print and (min-width: 400px);
@custom-media --foo-screen-medium screen and (min-width: 500px);
@custom-media --foo (--foo-print-medium) or (--foo-screen-medium)
```

Or:

```css
@custom-media --foo print and (min-width: 400px), screen and (min-width: 500px)
```

So I don't think there is any case that can't be expressed at the top level.
There is no capability that is lost by disallowing definitions of `@custom-media` inside `@media`.

Unsure if the same is true for `@supports`, `@layer`.

-----

This issue seems somewhat related to https://github.com/w3c/csswg-drafts/issues/12417

Where we also want to avoid multiple passes.

-- 
GitHub Notification of comment by romainmenke
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/12536#issuecomment-3132049599 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:33:22 UTC