Listen to Podcast Audio
When he’s not recording courses or writing about code, you’ll find him exploring South Florida with his wife, baby boy, and hyperactive Australian Shepherd.
The Power and Flexibility of CSS Variables
CSS can be immensely repetitive, and maintaining it can be cumbersome. If you’re using a CSS preprocessor like Sass, you’re already used to declaring variables to store and keep track of values in your stylesheets. Now you can use variables directly in your CSS — no special processing tools necessary!
CSS variables (custom properties) are a game changer in web development, and there are plenty of differences and advantages to using them over preprocessor variables. In fact, CSS variables offer more flexibility and power than preprocessor variables:
- They have dynamic capabilities — you can update values at runtime
- They inherit, cascade and can be scoped to any CSS selector or DOM element
- They make theming components easier than ever