CSS Conditional Rules Module Level 3 out now

New specification adds useful capabilities

New specification adds useful capabilities

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."

Thank you for reading 5 articles this month* Join now for unlimited access

Enjoy your first month for just £1 / $1 / €1

*Read 5 free articles per month without a subscription

Join now for unlimited access

Try first month for just £1 / $1 / €1

The Creative Bloq team is made up of a group of design fans, and has changed and evolved since Creative Bloq began back in 2012. The current website team consists of eight full-time members of staff: Editor Georgia Coggan, Deputy Editor Rosie Hilder, Ecommerce Editor Beren Neale, Senior News Editor Daniel Piper, Editor, Digital Art and 3D Ian Dean, Tech Reviews Editor Erlingur Einarsson and Ecommerce Writer Beth Nicholls and Staff Writer Natalie Fear, as well as a roster of freelancers from around the world. The 3D World and ImagineFX magazine teams also pitch in, ensuring that content from 3D World and ImagineFX is represented on Creative Bloq.