How to get and set CSS variable property values.
suggest changeTo get a value use the .getPropertyValue() method
element.style.getPropertyValue("--var")
To set a value use the .setProperty() method.
element.style.setProperty("--var", "NEW_VALUE")
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents