The Power (and Fun) of Scope with CSS Custom Properties
Custom properties makes CSS a programming language. There, I said it, no need to reply :). I’m still not in the practice of using CSS variables and I feel that I’m steadily being left behind, and also that I’m missing out on taking some serious shortcuts in my code.
You’re probably already at least a little familiar with CSS variables. If not, here’s a two-second overview: they are really called custom properties, you set them in declaration blocks like
An excerpt from The Power (and Fun) of Scope with CSS Custom Properties--size: 1em
and use them as values likefont-size: var(--size);
, they differ from preprocessor variables (e.g. they cascade), and here’s a guide with way more information.