I have this css:
body {
--animation: terminal-bar;
--size: 1.4;
}
how can I get value of --animation
in JavaScript?
I've tried this:
getComputedStyle(document.body)['--animation'];
document.body.style.getPropertyValue('--animation');
they both don't work, I've found this in developer tools:
document.body.computedStyleMap().get('--animation')[0]
but according to MDN it's suppored only in Chrome.
Is there relatively Cross-Browser solution (it don't need to work in IE) where you can get value of css variable set in css style sheet?