Leo Stramberg
2
Q:

custom properties css

/* create */
:root {
	--variable-name: variable-property;
}
/* use */
selector {
	property: var(--variable-name);
}
4
// get variable from inline style
element.style.getPropertyValue("--my-var");

// get variable from wherever
getComputedStyle(element).getPropertyValue("--my-var");

// set variable on inline style
element.style.setProperty("--my-var", jsVar + 4);
0

New to Communities?

Join the community