For something used by designers and developers the world over, CSS still misses one of the most fundamental aspects of programming and that is the ability to create and set variables. If someone wanted to the look of a page by only changing the colour scheme, it would require changes in a few places (depending on how the stylesheet was set up).
Recently, however, I came across a proposal set forward by Daniel Glazman and David Hyatt for CSS to support variables. Have a read through, it does make for some interesting reading. They propose defining variables using the at-rule (@variables) in a block.
It would look something like so (example taken from the proposal whose link is provided above)
@variables {
CorporateLogoBGColor: #fe8d12;
}
div.logoContainer {
background-color: var(CorporateLogoBGColor);
}
Now the real question is, how long would a proposal like this take to get adopted. I personally think it is a great idea and would make CSS a whole lot more powerful, and easier to manage.
At the moment if I want to use variables with CSS, I tend to lean towards using PHP to generate it. Its not too bad (although is a little slower), have a look at David Walsh’s blog to get more of an idea as to how this is done.