W3C home > Mailing lists > Public > www-style@w3.org > January 2010

[css3-selectors] Grouping

From: Nikita Popov <privat@ni-po.com>
Date: Fri, 08 Jan 2010 14:55:32 +0100
Message-ID: <4B473954.1080808@ni-po.com>
To: www-style list <www-style@w3.org>
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 

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 

Not very nice.
It would be much more convenient to group parts, that aren't changing:
(#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

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