This note was first posted on Monday, November 10th, 2008 (about 18 months ago).
Last edited on November 11th, 2008 (about 18 months ago)
There was a post a few weeks ago over at css-tricks that asked some well known web designers what features they would like to see in CSS. There was a follow up a couple of weeks later too.
A lot of the responses centred around typography on the web, a field that causes many web developers to cringe. Another common response was ability to do gradients and opacity reliably and consistently. All of the responses were good suggestions for future iterations of the CSS standard.
A few of the responses covered two features that I have been longing for since I first set hands on a stylesheet:
The first is assigning variable names to element attributes, in particular colours. Jeffrey Jordan Way covered it:
I wish we could assign variables in our stylesheets. For example, it would be nice if, rather than having to scroll to the top of my document every time I needed to grab the hex value for my chosen “blue”, I could simply assign that value to a variable called “myBlue”.
There are ways to achieve this using server-side languages [or client-side using Javascript] but they are cumbersome and complicated to implement.
The second thing I’d like to see in CSS is simple mathematical functions. Occasionally I would like to be able to do something like
.element {
width: 100%-150px;
}
which would let me do something like make a column div that lined up with something above it without the need for an extra, unnecessary div.
The commenters on both posts also made some interesting suggestions.