Menu

Tag Archives: CSS Variables

Update css variable values using JavaScript and update all stylesheet rules that reference that variable

Chris Coyier writes:

We posted not long ago about the difference between native CSS variables (custom properties) and preprocessor variables. There are a few esoteric things preprocessor variables can do that native variables cannot, but for the most part, native variables can do the same things. But, they are more powerful because of how they are live-interpolated. Should their values ever change (e.g. JavaScript, media query hits, etc) the change triggers immediate change on the site.

Cool, right? But still, how actually useful is that? What are the major use cases? I think we’re still seeing those shake out.

Categories

Meta

Ken Snyder is a Software Craftsman specializing in PHP and JavaScript. Ken works in Salt Lake city for Right Intel.
He is the co-founder of UtahJS, an educational non-profit aimed at promoting JavaScript in Utah.