DEV Community

Discussion on: Add dark mode to your website with just a few lines of code

supunkavinda profile image
Supun Kavinda

So, why would you prefer this to CSS variables?

albertomontalesi profile image
AlbertoM Author

Can you elaborate more?

coly010 profile image
Colum Ferry

CSS Variables for one aren't supported in IE11 :

So for enterprise development you need a ponyfill to support this.

Otherwise, you could certainly set up your theme.css to have a set of CSS Variables you reuse in the rest of your CSS files, then dynamically change between light-theme or dark-theme or other custom themes with JS