1/* create */
2:root {
3 --variable-name: variable-property;
4}
5/* use */
6selector {
7 property: var(--variable-name);
8}
1// get variable from inline style
2element.style.getPropertyValue("--my-var");
3
4// get variable from wherever
5getComputedStyle(element).getPropertyValue("--my-var");
6
7// set variable on inline style
8element.style.setProperty("--my-var", jsVar + 4);
9