79276129

Date: 2024-12-12 18:07:38
Score: 0.5
Natty:
Report link

A related issue is how to communicate a CSS value from JavaScript to CSS in real time (including for animation). Approach: use a property value ("variable") associated with the body element. Inherit it everywhere desired.

JS:

document.body.style.setProperty('--width1', '30px');

CSS:

#divA {width: var(--width1);}

Reasons:
  • No code block (0.5):
Posted by: David Spector