2 ms·
> Unlike with Sass variables/functions, which compile away into hardcoded values, CSS variables are dynamic. We can tweak any of these values using JavaScript,
by chiefalchemist 4y ago
> Unlike with Sass variables/functions, which compile away into hardcoded values, CSS variables are dynamic. We can tweak any of these values using JavaScript, and all the other ones will automatically update.
Might someone share a link - with a high signal to noise ratio - to a CodePen or tutorial that demos / gives examples of this? Perhaps some use cases as well?
I'm intrigued, but not experienced enough to know the best place(s) to start.
- alwillis 4y agoI explained why "we" (web developers) should want CSS custom properties (also known as CSS variables) versus Sass-style variables a couple of weeks ago when the CSS Working Group asked for feedback on nesting syntax. I included a couple of links to high signal-to-noise ratio articles on the advantages and use cases of CSS variables [1]. [1]: https://news.ycombinator.com/item?id=34019907 https://news.ycombinator.com/item?id=34019907