W3C home > Mailing lists > Public > public-css-archive@w3.org > June 2018

Re: [csswg-drafts] [selectors-4] are at-rules allowed to nest inside of style rules

From: Amelia Bellamy-Royds via GitHub <sysbot+gh@w3.org>
Date: Sun, 10 Jun 2018 21:17:33 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-396082842-1528665452-sysbot+gh@w3.org>
According to the most basic syntax parsing model, [yes, an at-rule can be nested within a declaration list](https://drafts.csswg.org/css-syntax/#parse-list-of-declarations).  However, that doesn't mean it will have an effect; as the note in the spec says, most at-rules will be ignored in a declaration list:

> Unexpected at-rules (which could be all of them, in a given context) are invalid and should be ignored by the consumer.

So you need to find the spec that defines the at-rule in question, to see where it may be "expected". For `@media` (and also `@supports`), the reference definition is in CSS Conditional Rules, [which states](https://drafts.csswg.org/css-conditional-3/#use):

> Conditional group rules are allowed at the top-level of a style sheet, and inside other conditional group rules. CSS processors must process such rules as described above.

So, an `@media` or `@supports` rule would currently be unexpected & invalid inside a declaration list.

But you could definitely make a proposal for a CSS Conditional Rules Level 4!

GitHub Notification of comment by AmeliaBR
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2752#issuecomment-396082842 using your GitHub account
Received on Sunday, 10 June 2018 21:17:38 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:41:31 UTC