Hawaiʻi's Technology Community

Back in 2008, Techhui had a discussion around the use of CSS variables in the discussion post, Are CSS variables the future?

Since then the web has come a long ways and Sass and Less are pretty commonly used in web design today.

The W3C also has a draft for CSS variables.   Usage is pretty straight forward.  You declare your variables with a 'data-' prefix as such:

:root {   data-header-color: #06c; }
h1 { background-color: data(header-color); }

This is pretty cutting edge so isn't supported by browsers today but is pretty exciting to me. I personally, would like
to see mixins in the spec as well.

Views: 143


You need to be a member of TechHui to add comments!

Join TechHui

Comment by Mike King on February 9, 2012 at 7:02pm

I can't wait for CSS variables to be natively supported; this will simplify the process of theming websites 10-fold. Until then, it looks like I'll be diving in to LESS ;)

Comment by Daniel Leuck on February 8, 2012 at 10:26am

This is very good news. CSS desperately needs variables to be DRY, terse and maximally useful to designers. Having to repeat the same four colors in your color scheme 200 times is ridiculous.


web design, web development, localization

© 2024   Created by Daniel Leuck.   Powered by

Badges  |  Report an Issue  |  Terms of Service