4 ms·
CSS Variables are here
- TweedHeads 18y agoGreat! They will make my life easier. Only if HTML implemented the same concept, one can dream.
- ashleyw 18y agoCool! Though, this will be one of those features which is only useful in years to come when Firefox 4 and IE9 supports it, sadly. But once it has a wide audience it will be an amazing feature!
- jamesjyu 18y agoAgreed. But alas, I hate it when these features are announced, because they will only tease me for years to come until it's widely released.
- gcv 18y agoI read somewhere that the W3C originally didn't want to do this because it deemed that CSS shouldn't become a programming language. Ten years of nightmarish style sheets later...
- alabut 18y agoThis change definitely won't make it a programming language - they're not even real variables, they're more like XSLT's definition of variables. Also known as constants.
- ajross 18y agoNot to be too snarky: but what feature of CSS variables can't be emulated just as cleanly with a little jQuery? There is always going to be a spectrum between "style" and "behavior" attached to elements, and it strikes me as much more productive to try to solve the problem at the level of a programming environment instead of a no-longer-quite-as-static-as-originally-envisioned style description language.
- Hexstream 18y agoDoesn't jQuery require client-side javascript? If so that precludes its use for crucial parts of CSS in my mind. Hasn't anyone thought of implementing a "static" version of jQuery that makes modifications at compile-time on the server?
- jamesbritt 18y agoI think most Web frameworks have some means of templating CSS files.
- twism 18y agoycfeeds.com uses server-side jquery and (although ycfeeds.com does not do it much) can manipulate dom styles and add class names to elements using CSS3 at "compile time".
- bprater 18y agoElegance.
- ajross 18y agoOK, I call shenanigans here. In what was is adding a feature to a non-programmable, designed-by-commitee data format instead of using a tight, well-defined and very powerful feature of the pre-existing development environment ... elegant? My original question was, after all, an aesthetic one. I guess I just simply don't understand your thinking here.
- KevinMS 18y agoCSS variables also here http://moonfall.org http://moonfall.org
- jawngee 18y agoI posted about this before on HN, but I've implemented CSS variables using PHP as an intermediary. This implementation is coded to the same spec that webkit is using, so the stylesheets will be usable once more browsers support it. You can peep it here: http://interfacelab.com/variables-in-css-via-php/ http://interfacelab.com/variables-in-css-via-php/ Probably pretty easy to port to another runtime.
- bprater 18y agoLong overdue. But it's good to see it implemented!