JSFiddle - React, Tailwind, and code Playground
by Ting-Yuan Chang
HTML
<div class="abc">
abc
</div>
CSS
body {
background: var(--color, black ) !important;
}
.abc {
background: pink;
/*width: var(--divSize, 300px) !important;
height: var(--divSize, 300px) !important;*/
width: calc(1 *300px);
}
.abc {
width: 400px;
height: 200px;
}
JavaScript
document.documentElement.style.setProperty('--color', 'red');
/*document.documentElement.style.removeProperty('--color');*/
document.documentElement.style.setProperty('--divSize', '1');