W3C home > Mailing lists > Public > www-style@w3.org > September 2008

Re: [Css Variables] Variable Declaration Blocks

From: Brad Kemper <brkemper.comcast@gmail.com>
Date: Fri, 26 Sep 2008 09:02:41 -0700
Cc: <www-style@w3.org>
Message-Id: <0D654162-5514-4E94-B873-881B38DE3D8B@gmail.com>
To: Mike Wilson <mikewse@hotmail.com>


On Sep 26, 2008, at 5:46 AM, Mike Wilson wrote:

> Brad Kemper wrote:
>> But if the author wanted it to act as a constant,
>> where "first rule overrides later rules", he
>> could add a keyword to that rule that would
>> accomplish that by adding 1,000,000 to the
>> specificity calculation:
>
> 	@define constant {
> 	 mySimpleVariable: 5px;
> 	 myComplexVariable {
> 	     width: 5em;
> 	     height: 5em;
> 	 }
> 	}
>
> But how would you treat a subsequent
>  @define constant mySimpleVariable
> assignment in the same document?
>
> This is where Andrew wants the first clause to have
> precedence and this means we either have to invent a
> position-dependent specificity calculation or change
> the cascade algorithm.

In my view, if you added the keyword "constant" to the variable  
definition, then it would act more like a constant, with the first one  
taking precedence, and subsequent imported ones useful as default  
values in case the first one is missing. As Andrew described. I don't  
see any reason to fight against this; you can have your cake and eat  
it too.


> We already have !important for explicitly pointing
> out a certain rule to have precedence.

Not the same thing. If you have two rules in which !important is  
applied to the same value with the same specificity, then the second  
one wins. Which is opposite of how constants work. The whole idea  
behind constants is that they are like variables that don't change  
once declared. That is a useful thing to have.
Received on Friday, 26 September 2008 16:03:28 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:55:12 GMT