[csswg-drafts] [css-mixins-1] Are @mixin rules valid within other at-rules? (#12417)

andruud has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-mixins-1] Are @mixin rules valid within other at-rules? ==
For example, are `@mixin` rules valid within `@container`?

```
@container (...) {
  @mixin --m() {
    /* style rules */
  }
}
```

If yes, we already know that `--m()` isn't defined conditionally based on CQ evaluation (https://drafts.csswg.org/css-conditional-5/#container-rule, last paragraph of chapter), but are the inner _style rules_ affected?

```
div {
  @apply --m();
}
```

In other words, does the above `@apply` rule "remember" that the referenced mixin is enclosed by an `@container`? Any decision we make should hopefully answer the same question about `@layer`, `@starting-style`, etc.

My initial thought is that (for simplicity) we should make `@mixin` invalid within any at-rule except conditional rules with the ["old school" processing model](https://drafts.csswg.org/css-conditional-3/#processing) (i.e. currently `@media` and `@supports`).

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/12417 using your GitHub account


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

Received on Monday, 30 June 2025 11:57:39 UTC