Change a CSS Variable with Javascript

In this video I show you how to change a CSS Variable with Javascript, we will change the background to a fixed value and the text color will be selectable via a color input field.

Video on Scrimba

The nice thing about Scrimba is, you can pause and change the code yourself to see more clearly how everything works!

Change a CSS Variable with Javascript Video on Scrimba

Video on YouTube

If you prefer YouTube, I uploaded a screen recording of the Scrimba.

Change a CSS Variable with Javascript Video on YouTube

Follow my YouTube channel for more videos, as I will not create a blog post for every video.

Converting Colors

Converting Colors allows you to convert between 17 different color formats like RGB, CMYK, HSV, HSL, CIELab, Android, Decimal, and YUV.

Made with 💘, 🍺 and 🍫 by Andreas Zettl. If you have questions send me an email to info@convertingcolors.com!

Privacy Policy  ·  Imprint  ·  Cookie List & Settings  ·  Statistics

Menu

Support