@supports and @document conditional group rules added
The first draft of the CSS Conditional Rules Module Level 3 has been published. The specification permits conditional group rules to contain other @-rules, and defines two new types of conditional group rules: @supports and @document.
From the introduction: "[CSS21] defines one type of conditional group rule, the ‘@media’ rule, and allows only rulesets (not other @-rules) inside of it. The ‘@media’ rule provides the ability to have media-specific style sheets, which is also provided by style sheet linking features such as ‘@import’ and <link>. The restrictions on the contents of ‘@media’ rules made them less useful; they have forced authors using CSS features involving @-rules in media-specific style sheets to use separate style sheets for each medium.
"This specification extends the rules for the contents of conditional group rules to allow other @-rules, which enables authors to combine CSS features involving @-rules with media specific style sheets within a single style sheet.
"This specification also defines additional types of conditional group rules, ‘@supports’ and ‘@document’, to address author and user requirements.
"The ‘@supports’ rule allows CSS to be conditioned on implementation support for CSS properties and values.
"The ‘@document’ rule allows CSS to be conditioned on the page to which the style sheet is being applied."
While this development is welcomed by many, there is some division of opinion over whether this strategy is good practice. Web standards guru Molly E. Holzschlag summarised the situation thus:
"CSS Conditional Rules address a variety of needs that need addressing. I've heard a lot of folks say that they'd prefer conditions in their CSS rather than HTML documents, which makes sense from a pragmatic standpoint.
"Where I think things get sticky is that the more conditions we add to CSS, the more programmatic it becomes, and that in my opinion is the core concern. Designers are rightfully concerned that it will be out of their skill or interest range. Developers are equally correct in questioning whether these tasks belong in CSS at all, keeping CSS in the realm of declarative rather than programmatic techniques and processing. Some fall in the middle, just hoping a solution will come along that's interoperable, easy and quick to implement."
What do you think? Let us know in the comments.