- From: Philip TAYLOR <P.Taylor@Rhul.Ac.Uk>
- Date: Thu, 10 Mar 2005 17:58:53 +0000
- To: www-style@w3.org
Looking at a colleague's CSS recently, I couldn't help but think that "good" CSS might be a lot easier to compose if CSS were to support the concept of clustering. By this I mean a third type of entity, directly analogous to IDs and Classes, but referenced solely by CSS, not by HTML. At the moment, if one wants to use the same subset of properties in a number of environments, one enumerates the environments (separated by commas) and then enumerates the properties to be used by those environments, as in : <tag 1>, <tag 2>, <tag 3>.<class>, tag 4#ID, <tag 5> <tag 6> ... { <property 1>; <property 2>; ... <property n> } If those environments are also to have properties unique to each, or to some subset of the original cluster, it is necessary to enumerate them again, as in : <tag 1>, <tag 2> {<properties common to only <tag 1> and <tag 2>} <tag 1> {<properties unique to tag 1>} <tag 2> {<properties unique to tag 2>} <etc> This is less than obvious to some CSS authors, who simply duplicate the common properties over and over again in their style sheets. If, however, there were to be a third type of entity whose function were solely to permit the clustering of common properties, and if the syntax were to denote such entities by the use of an initial character such as "&" (analogous to "." for classes and "#" for IDs), one could then have rules such as : &<name 1> {<property 1>; <property 2>; ... <property n>} The properties associated with <name 1> could then be used within other CSS rules, as in : <tag 1>, <tag 2> {&<name 1>; <properties common to only <tag 1> and <tag 2>} I would be interested to learn if this idea has been proposed previously, and if so, what the consensus was. Philip Taylor
Received on Thursday, 10 March 2005 18:01:50 UTC