3 ms·
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 nee
by runarberg 5y ago
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.