RE: [css3] Suggestion: Selector variables or "synonyms"

I think part of the OP's suggestion correlates to a more
generic feature; inheritance or composition between CSS 
rules. The lack of this causes us to have to repeat 
ourselves when wanting to map property assignments to 
multiple element selections. Example:

  input[type="radio"] {
    color: #444;
    font-size: 77%;
    /*other settings for radio*/
  }
  input[type="checkbox"] {
    color: #444;
    font-size: 77%;
    /*other settings for radio*/
  }

Above we have to repeat the common property assignments. 
As an alternative, they may be extracted to a separate 
rule but then we have to repeat the selectors instead:

  input[type="radio"], input[type="checkbox"] {
    color: #444;
    font-size: 77%;
  }
  input[type="radio"] {...}
  input[type="checkbox"] {...}

Adding the possibility to let one rule inherit the 
property assignments from another rule (or actually 
declaration set) could look something like this:

  .mycolorandfont {
    color: #444;
    font-size: 77%;
  }
  input[type="radio"] {
    INHERIT_DECLS(.mycolorandfont);
    /*other settings for radio*/
  }
  input[type="checkbox"] {
    INHERIT_DECLS(.mycolorandfont);
    /*other settings for radio*/
  }

Note that I am not suggesting any particular syntax here,
it could be using normal classes like above, some new @-
rules, or maybe something completely different based on
object-oriented keywords.

Best regards
Mike Wilson

Received on Friday, 8 February 2008 09:20:15 UTC