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

>From the perspective of PHP (and perl or bash) scripters, dollars in CSS
would create everyday problems.

Heredocs:

print <<<CSS
<style>
p {
color: $bar;
}
</style>
CSS;

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:

<script>
var foo = 'hello';
alert( foo );
</script>

<style>
div {
var-foo: red;
}
.mod {
color: var( foo );
}
</style>

Received on Saturday, 26 May 2012 19:09:56 UTC