0

Well, I want to use some css vars in my js code.

Here is the part of my .css file and the .js code:

const root = document.querySelector(":root");
const msgColor = getComputedStyle(root).getPropertyValue("--msg-color");
console.log(msgColor);
:root {
  --msg-color: crimson;
  --msg-text: floralwhite;
}

The problem is that in chrome, safari and the new Edge I'm getting right the color value in my constant, but in firefox, doesn't working.

Any ideas? Thanks.

axrst
  • 1
  • 1
  • 1
    "_in chrome, firefox and the new Edge I'm getting right ... , but in firefox, doesn't working_" In which browser your code eventually "doesn't work"? (The code seems to work in FF77 as it is.) – Teemu Jun 17 '20 at 08:39
  • Sorry, I misspelled. In chrome, safari, and new edge is working. In firefox it does'nt. – axrst Jun 17 '20 at 09:30

1 Answers1

0

It seems it was the version of firefox. It was the 68.x.x Now with the 77.0.1 works fine.

axrst
  • 1
  • 1