I mentioned CSS Variables previously, and now the proposal has been published and I agree with authors Daniel Glazman and David Hyatt when they say:
We expect CSS Variables to receive a very positive feedback from both the Web authors’ community and browser vendors.
The syntax will be to declare the variables using the @variables at-rule, then calling them with the var() function:
@variables { keyColor: #f00; }
h1 { color: var(keyColor); }
That’s it. Beautifully simple, and I really, really look forward to seeing it implemented.
Dave Woods - HTML, CSS, Web Design » CSS Variables [April 9th, 2008, 1:13 pm; Permalink]
[…] first heard the news from Peter’s blog over at Broken Links and thought it would be of great interested to most of the readers […]
Arjan [April 9th, 2008, 5:47 pm; Permalink]
It is nice, but not required for most websites. Most of the times a simple Find/Replace action in the texteditor is enough.
I would enjoy it when browsers start to support the “CSS3 calc function”:http://www.w3.org/TR/css3-values/#calc .
(By the way, your preview function breaks when I use an ampersand.)
Arjan [April 9th, 2008, 5:49 pm; Permalink]
Ah, and Textile seems to break when I use a hash in the URL of a link…
Binny V A [April 9th, 2008, 6:14 pm; Permalink]
I would have preferred something simpler/easier like $var_name - but then again, something is better than nothing.
Peter [April 9th, 2008, 6:33 pm; Permalink]
@ Arjan: It’s true that a search and replace would be useful in most cases, but not all; I think this is a very simple solution to cover all eventualities. And thanks for the info about the previews & Textile; I’ll look into it.
@ Binny: Using a $ would be the better solution for anyone used to using programming languages, but the use of enclosing brackets is more consistent when using functions in CSS (src(), calc(), etc).