W3C home > Mailing lists > Public > www-style@w3.org > February 2009

[css21 + mediaqueries] Allow media groups in media queries

From: Giovanni Campagna <scampa.giovanni@gmail.com>
Date: Mon, 23 Feb 2009 15:02:41 +0100
Message-ID: <65307430902230602r3f8242f2k414b8cd493ac9053@mail.gmail.com>
To: www-style@w3.org
Currently sect. 7.3.1 of CSS21 defines media groups, that are a set of
keyword to use in the "Applies to" part of property definition, and
maps those groups to media types, to specify what properties UAs must
implement and what features should authors expect from the various
My proposal is to allow those keywords anywhere a Media Query is
allowed, @media, @import for CSS, but also <?xml-stylesheet?> or
An example of this is

@media interactive {
strike:hover { text-decoration:line-through; }

Use cases:

1) If the above example was slightly more heavy, it could be grouped
in an external @import-ed file. Non interactive UA would then need not
to download it, saving bandwidth.

@import "complex_visual_effects.css" bitmap;
where complex_visual_effects.css contains hundreds KB of absolute
positioning, background images, transformation matrices...

2) Many media types are both interactive and static, continuous and
paged, grid and bitmap

@media screen
applies to all types of desktop browsers, in static and interactive
mode; to select only those in interactive mode:
@media interactive

3) Media groups are simple shorthands for multiple media types:

@media paged is a shorthand for @media print, projection, embossed [,
handheld, tv]

4) Media groups allow forward compatible stylesheets, ie current
stylesheets applied to future media types

@media audio
would apply to handheld, screen, tv, but also the reader media type,
if it will implemented.

Additional Changes (outside CSS21):

- change media query syntax to:

 : [ONLY | NOT]? S* media_name S* [ AND S* expression ]*
 | expression [ AND S* expression ]*
 : media_type | media_group
 : [ '(' S* media_feature S* [':' S* value]? ')' S* ] | media_group |
[ '(' NOT? S* media_group ')' ]

That is, allow "screen and interactive" or "paged and (not audio)" or
"interactive and (min-color:256)"

Actually, this could be simplified more in:

 : [ONLY | NOT]? S* expression S* [ AND S* expression ]*
 : [ '(' S* media_feature S* [':' S* value]? ')' S* ] | '(' NOT?
expression ')' | media_name

This would allow useless things like "screen and handheld" (always
false), but also things like "interactive and (not screen)" or "(not
(color))" (equivalent to "all and (not (color))")

- drop the "grid" media feature
because it is enhanced by the grid media type

As usual, I hope that you'll like these proposals

Received on Monday, 23 February 2009 14:03:15 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:38:24 UTC