W3C home > Mailing lists > Public > www-style@w3.org > June 2012

Re: [css-variables] CSS Variables are a NEW kind of variable

From: François REMY <fremycompany_pub@yahoo.fr>
Date: Wed, 13 Jun 2012 23:13:07 +0200
Message-ID: <2F47CF3C69A74CFBA380AFC32D6244D7@FREMYD2>
To: "Chris Eppstein" <chris@eppsteins.net>, "Tab Atkins Jr." <jackalmage@gmail.com>
Cc: "Divya Manian" <manian@adobe.com>, <www-style@w3.org>
This is actually an extension I proposed for CSS Variables Level 2.

    html { my-preferred-color: lime; }
    .pBackground { background: $my-peferred-color; }
    .feather { box-shadow: 0px 0px 5px $background-color; }

    .feater.pBackground == { background: lime; box-shadow: 0px 0px 5px lime; }

However, it would - like for CSS Variables – use the SPECIFIED value for the property and not the COMPUTED one (using the latter is impossible because it would create implicit dependencies that would be a nightmare for both implementors and authors), except that ‘initial’ and ‘inherit’ would be resolved (this is similar to what happens when you use ‘inherit’ in your stylesheet). This limits the scope where this can be useful. 



Going from there, this is very handy to consider variables and properties toegether if you consider new “replacement” functions like var-inherit(): 

    li.important {
        border-left: 3px solid inherit(color);
        color: red;
    }

or

    .switchToBlack { 
        my-old-color: inherit(my-color); 
        my-color: black;
    }

or

    * {
        my-align-child-content: auto; /* not-inherited variable */
        align-content: inherit(my-align-child-content);
    }

    #someElement {
        my-align-child-content: center;
    }

However, those proposals are left for L2 because this requires to extend the specification and we want variables as soon as possible.

François

From: Chris Eppstein 
Sent: Wednesday, June 13, 2012 10:38 PM
To: Tab Atkins Jr. 
Cc: Divya Manian ; www-style@w3.org 
Subject: Re: [css-variables] CSS Variables are a NEW kind of variable
If they are normal properties, why can I not access the value of other properties? 

Chris


On Wed, Jun 13, 2012 at 1:31 PM, Tab Atkins Jr. <jackalmage@gmail.com> wrote:

  On Wed, Jun 13, 2012 at 1:25 PM, Divya Manian <manian@adobe.com> wrote:
  > Sorry to flog this dead horse again.
  >
  > But there has been no satisfactory answer to why variables are still being
  > defined as a 'property' instead of having a new definition.


  Because the things that define variables *are* properties.  There's no
  difference, in any way, from a normal property.  Trying to distinguish
  them syntactically would just be overly verbose and would hide the
  fact that they're just normal properties.

  ~TJ
Received on Wednesday, 13 June 2012 21:13:37 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:55 GMT