Chapter 4: Custom Properties

For years, variables were one of the most commonly requested CSS features. It took years to work through the details of the syntax and decide how variables would fit into existing rules governing cascade and inheritance. Now they’re available to developers in the form of CSS custom properties.

Custom properties make it easier to manage colors, fonts, size, and animation values, and ensure their consistency across a codebase. In this chapter, we’ll look at:

  • how to define properties and set default values for those properties
  • how custom properties interact with cascade and inheritance rules
  • how to use custom properties with media queries
  • how to use custom properties and the HSL color space to generate color palettes ...

Get CSS Master, 3rd 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.