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

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

From: Pete Boere <pete@the-echoplex.net>
Date: Sat, 26 May 2012 20:09:30 +0100
Message-ID: <CAKZZz6cvcOkx=2W-6umM2S=6aQraxoOMBY4fRpkBp6e9s0cy+A@mail.gmail.com>
To: www-style@w3.org
>From the perspective of PHP (and perl or bash) scripters, dollars in CSS
would create everyday problems.


print <<<CSS
p {
color: $bar;

I'm not sure what is supposed to happen with CSS variables used in inline
styles, but variable interpolation when printing html attributes is very
common in PHP:

echo "<hr style='color: $foo;' />";

In favour of the existing proposal – other than not creating any more
escaping headaches – is that I like the var prefix as it compliments
variable declarations in JavaScript.

Since JavaScript is undoubtedly the most familiar (or only language
familiar to most CSS authors) the allusion is a strong point in favour, imo:

var foo = 'hello';
alert( foo );

div {
var-foo: red;
.mod {
color: var( foo );
Received on Saturday, 26 May 2012 19:09:56 UTC

This archive was generated by hypermail 2.4.0 : Monday, 23 January 2023 02:14:15 UTC