News for hackers. Stuff that matters.
Re:Real-world CSS vs. CSS-in-JS performance comparison by runarberg on Tuesday June 08, 2021 @06:05PM (#27441601)
I’ve had great luck achieving that with CSS custom properties. I assign a custom property to a style rule and then change that property with JavaScript when needed.

I also find much state has a nice selector (e.g. :hover, :checked, :invalid, :empty, :focus-inside, etc.) or media queries `@media (prefers-color-scheme: dark)` which I can change the custom property values inside. So it is really an exception when I manually need to change the value of custom properties with JavaScript.

There are no comments on this comment yet.