Chapter 3: Custom Properties
For years, variables were one of the most commonly requested CSS features. Variables make it easier to manage colors, fonts, size, and animation values, and to ensure their consistency across a codebase.
It took years to work through the details of the syntax and decide how variables would fit into existing rules governing the cascade and inheritance. Now they’re available to developers in the form of CSS custom properties.
In this chapter, we’ll discuss the syntax of CSS custom properties. We’ll look at:
- how to define properties and set default values for those properties
- how the rules of the cascade and inheritance work with custom properties
- how to use custom properties with media queries
By the end, you should ...
Get CSS Master, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.