[css3-selectors] Grouping

Often several elements on a page have similar style. So you want to 
group them in one rule.
The only possibility to do this, is the ",". The disadvantage is, that 
you often need to repeat large parts of the rule, but only small parts 
change.

An Example: My body-Elements gets a class, containing the actual page, 
e.g. class="add". Now I want to give all input, textarea and select 
elements on this page, that are in two different divs some styling:

.add #authors input, .add #authors select, .add #authors textarea,
.add #publications input, .add #publications select, .add #publications 
textarea
{
...
}

Not very nice.
It would be much more convenient to group parts, that aren't changing:
.add
(#authors input, #authors select, #authors textarea,
#publications input, #publications select, #publications textarea)
{
...
}

Or even
.add (#authors, #publications) (input, select, textarea)
{
...
}

The code gets shorter and more readable.

Received on Friday, 8 January 2010 13:55:58 UTC