custom properties css

Solutions on MaxInterview for custom properties css by the best coders in the world

showing results for - "custom properties css"
Emmy
20 Aug 2016
1/* create */
2:root {
3	--variable-name: variable-property;
4}
5/* use */
6selector {
7	property: var(--variable-name);
8}
Angela
17 Jul 2016
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