
WebKit now supports CSS Variables  - nickb
http://lists.w3.org/Archives/Public/www-style/2008Jun/0230.html
======
makecheck
I have definitely thought about the _convenience_ of variables before, but it
isn't good to bloat CSS itself with them.

The spec's examples like "CorporateLogoBGColor" could be handled by a simple
tool that generates CSS. The simplest case is a preprocessor-like input/output
scheme. For example, a script (in a complete language with real variables,
functions, etc.) and a template file (with references).

That way, there's separation of responsibility. The browser doesn't have to be
more complex, risking bugs and exploits and slowdowns, because the
"requirement" for variables isn't really there.

What usually happens after someone adds "variables", is somebody says hey, we
need functions too. And arithmetic. And oh wait...now it's a full-fledged
language. Oops...

~~~
Lozzer
I agree that the examples could be done with preprocessing a template, but I'd
like to be able to simple arithmetic in the CSS file, just for the ability to
mix relative and absolute units without kludging in extra divs. For example:

left: 20% - 20px;

I wish I'd written down some of the times I'd wanted to do something like that
so I could point to a specific example. The obvious one of centering a fixed
width image can be done with auto margins (though I've a feeling that didn't
work in IE6).

~~~
makecheck
That is a pretty good example, actually. Yes, if it is an expression whose
value _cannot_ be known until the browser figures it out, then there could be
value in having CSS support it.

But JavaScript supports dynamic lookup of style information, and has math
expressions. It may be that CSS is still the best place for such an
enhancement, but the trick is to always look for the best place to make these
changes. Would a JavaScript onLoad script like "page.styles['x'].margin.left =
page.width_in_pixels()*0.20 - 20" be as good, better or worse? I'm not even
sure myself.

~~~
Raphael
It's just a matter of convenience and taste. CSS is for presentation and
JavaScript is for behavior.

~~~
IsaacSchlueter
You could argue that a taste for convenience is a pretty good definition of a
quality developer ;)

