Re: CSS Variables Draft Proposal

Tab Atkins Jr.:
> <http://www.xanthir.com/blog/b4AD0>.

Sometimes variables have been requested to work inside selectors and even properties, too. I think it’s a good thing this proposal does support only values (and sub-values).

That being said, custom units as in “font-size: 12$dd” (for the Didot point) could be useful, but are certainly not the most convincing nor common use case.

> Variable Syntax
> 
> The syntax for variables is very simple.  Variables are defined in an
> `@var` rule anywhere in the sheet

How much are you decided on using the abbreviation “var”? 
Possible alternatives:

 – @let
 – @set
 – @new
 – @value
 – @macro
 – @define
 – @declare
 – @keyword
 – @constant
 – @variable
 – …

How about an (optional) equals sign or colon after the name?

A little verbosity sometimes does wonders to usability and CSS tends to avoid abbreviations, except in form of acronyms (as in ‘url’ and ‘rgb’ for instance).

> Multiple Variable Declarations
> 
> If the same variable name is declared in multiple @var rules, the last
> valid declaration wins.  For this purpose, UA-defined variables come
> before all author-defined rules, which come before all user-defined
> rules.  Within each category, the ordering is document order.

I am against making variables available across sources (i.e. the trinity of user agent, author and user), except perhaps when explicitly requested to, like this:

  @var $foo bar !important;
or
  @var $foo bar !override;

That, of course, would require to end the variable content when encountering an exclamation mark, i.e.

  @var $foo bar !important;
  baz {quuz: $foo}

would be different from

  baz {quuz: bar !important}

Received on Tuesday, 15 February 2011 16:08:26 UTC