W3C home > Mailing lists > Public > www-style@w3.org > February 2011

Re: CSS Variables Draft Proposal

From: Christoph Päper <christoph.paeper@crissov.de>
Date: Tue, 15 Feb 2011 17:07:51 +0100
Message-Id: <EDA70F6B-2EEE-4FBE-8A6D-77AEFBFA0D1C@crissov.de>
To: www-style list <www-style@w3.org>
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;
  @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

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