How to get and set CSS variable property values

suggest change

Custom property names are case-sensitive. element.style only sees inline declarations. A variable set in a stylesheet is read from the computed style.

element.style.setProperty("--var", "NEW_VALUE");
getComputedStyle(element).getPropertyValue("--var");

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents