[css-variables] CSS Referencing

Matthew Wilcox (2012-01-05 18:08):

> div#one { height: #two; }
> div#two { height: #one; }

Functionality like this has been requested and hence discussed many a time before. The current Editor’s Draft related to it is located at <http://dev.w3.org/csswg/css-variables/>.

Your choice of words, however, made me think. Could exclamation mark syntax, as known from ‘important’, work for variables?

  foo {property: common-value   !set(myvar);}
  bar {property: fallback-value !get(myvar);}

gets the relative, specified value in another place. It would be cool if you could also use the absolute, computed value elsewhere,

  baz {property: fallback-value !use(myvar);}

but since “foo” doesn’t need to be unique it probably can’t work, except if it were fine to use the last computetd value from the closest (box or element) ancestor.

Furthermore, this hardly works with shorthand properties, because you could only store and recall a complete set of values, not single ones. 
I’m not sure the Grammar allowed exclamation marks inside pseudo functions:

  quuz {property: calc(1px + 1px !use(myvar));}

Received on Sunday, 8 January 2012 18:19:23 UTC