Syntax - Tasty Web Development Treats cover image

What's New in CSS? Variables, Scoping, New Selectors and Color Functions

Syntax - Tasty Web Development Treats

00:00

How to Use CSS Variables With JavaScript

CSS variables are dynamic and I think that is their most powerful feature. Unlike with sas or stylus, you'd have to update each individual hex value because at the end of the day, those color values or whatever you're using is just getting output into CSS. What you can do is rather than use like a data dash attribute, which I've used quite a bit in the past,. then you've had to use JavaScript to pick up the data attributes and then inject them into yourcss.

Play episode from 10:35
Transcript

The AI-powered Podcast Player

Save insights by tapping your headphones, chat with episodes, discover the best highlights - and more!
App store bannerPlay store banner
Get the app