Answers for "css variable change part or variable"

CSS
73

css set variable

:root {
  --main-bg-color: coral;
}

#div1 {
  background-color: var(--main-bg-color);
}

#div2 {
  background-color: var(--main-bg-color);
}
Posted by: Guest on December-27-2019
0

change css variables

/*css :
:root{
--bgc : #fff;
}
*/
//js
let root = document.querySelector(":root")
root.style.setProperty('--bgc', 'cyan');
Posted by: Guest on April-14-2022

Code answers related to "css variable change part or variable"

Browse Popular Code Answers by Language