Controlling CSS Variables from JavaScript

Did you know that it is possible to retrieve the value of CSS variables and update their values from inside your JavaScript code?

Code from video:

11 thoughts on “Controlling CSS Variables from JavaScript

  1. Too complicated and cumbersome for me.
    I much rather prefer : = "value";
    for example: document.getElementById("name").style.backgroundColor = "rgba(255,255,255,1)"

  2. Steve, I have no doubt you're a very capable developer but why do you use let and const the way you do? Best practice is using const as your default and only using let when the variable needs to be reassigned. However it seems you declare everything with let except for arrow functions, which is odd.

Leave a Reply

Your email address will not be published.