Re: CSS Variables

On Feb 7, 2011, at 1:35 PM, L. David Baron wrote:

> On Saturday 2011-02-05 16:34 -0800, Tab Atkins Jr. wrote:
>> The syntax isn't complex.  What we're going with so far is this:
>> 
>> @var $foo red;
>> bar {
>>  color: $foo;
>> }
>> 
>> The @var rule declares a single variable, taking a name and then
>> arbitrary CSS as a value.  The var name must start with a $ character,
>> so we can use $ as an unambiguous indicator in the content that a
>> variable is being used.
> 
> What does "arbitrary CSS" mean?  Is it a character stream?  A token
> stream?  A valid value?  A valid part of a value?  (Failing to
> answer this question clearly before implementing may lead to a spec
> that depends on the details of a particular implementation.  The
> answer to this question also has *significant* effects on how hard
> this proposal is to implement, but those answers may be different
> for different implementations.)
> 
> Or, to put it more concretely, which of the following lines are valid:
> 
>  @var $a x;             p { width: 20p$a; }
>  @var $b Roman";        p { font-family: "Times New $b; }
>  @var $c 2px;           p { text-shadow: green $c $c; }
>  @var $d green 2px 2px; p { text-shadow $d; }
>  @var $e green 2px 2px; p { text-shadow $e, $e; }
>  @var $f green 2px 2px; p { text-shadow $f 3px; }
>  @var $g 2px, green;    p { text-shadow: blue 2px $g 1px 1px; }

What about:
@var $a px;		p { width: 100$a; }
or (I don't see how to do it with the '$' syntax):
@var b 200;		p { width: var(b)px; }

Received on Tuesday, 8 February 2011 18:20:05 UTC