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

Re: [css-variables] Using $foo as the syntax for variables

From: Florian Rivoal <florianr@opera.com>
Date: Wed, 23 May 2012 12:14:53 +0200
To: "Ojan Vafai" <ojan@chromium.org>
Cc: www-style@w3.org
Message-ID: <op.weraq31m4p7avi@localhost.localdomain>
On Wed, 23 May 2012 02:10:39 +0200, Ojan Vafai <ojan@chromium.org> wrote:

> Would someone be willing to summarize what the proposed extensions are?

I know of 2:

1) var-default(foo, default-value) which uses evaluates
to default if foo is undefined or invalid.

2) var-inherit(foo) which uses the inherited value of the variable,
rather than its current value, allowing you to write things like this:

/*nested x elements get alternating background colors*/
x {
   var-foo:blue;
   var-foo2:red;
   background:var(foo);
}
x x {
   var-foo:var-inherit(foo2);
   var-foo2:var-inherit(foo);

}

or like this:

/*the width of the border is proportional to the depth in the tree.*/
:root {
   var-foo:1px;
}
* {
   var-foo: calc(var-inherit(foo) + 1px);
   border: var(foo) solid black;
}
Received on Wednesday, 23 May 2012 10:15:25 GMT

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