Answers for "custom properties css"

CSS
4

css custom properties

/* create */
:root {
	--variable-name: variable-property;
}
/* use */
selector {
	property: var(--variable-name);
}
Posted by: Guest on March-04-2020
0

custom properties css

// 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);
Posted by: Guest on November-30-2020

Browse Popular Code Answers by Language