-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Responsive Web Design with HTML5 and CSS - Fifth Edition
By :
Some years ago, I wrote a book about Sass, a superset language for CSS. One of the main selling points of Sass, alongside things such as nesting, which we looked at in Chapter 6, CSS Nesting, Layers, Selectors, and More, was that it allowed you to store often-used values as variables. Things such as colors could be named more simply as words rather than hex or RGB values, and that allowed for far easier reuse of those values.
Some years later, CSS got custom properties, which at first glance seemed like nothing more than a way to have variables in CSS, without needing a superset language such as Sass. It turns out that CSS custom properties are far more powerful than Sass variables. So powerful, in fact, that this whole chapter is largely dedicated to them.
Another, newer CSS addition that goes hand in hand with custom properties is the ability to manipulate values, including custom properties, with mathematical functions. Exploring these...