Variables in CSS?
Posted on July 1st, 2008, by Cristian in Xhtml & CSSHow long have you wanted to name colors and such in your CSS instead of having to use search and replace (which breaks if you share the same colors ?
Thanks to Daniel Glazman and David Hyatt we have a proposal .
@variables { CorporateLogoBGColor: #fe8d12; }
div.logoContainer { background-color: var(CorporateLogoBGColor ); }
I expect CSS Variables to receive a very positive feedback from community and browser vendors and get implemented in all browsers!
WebKit now has an experimental implementation of CSS variables : You can test this feature using a WebKit nightly.


[...] can read the rest of this blog post by going to the original source, here [...]
great idea! @variables sounds good.
i’ve done similar things by making a .php file, then sending header information to read it as CSS. Then you can just type your CSS but put in blocks with variables. i’ve even seed applications of this where you could adjust a few inputs and pass js variables to css files using ajax…. i can’t remember exactly where i saw that technique….
but anyway, there should definitely be a standard for css variables.