2

I'm working currently with ReactJS and I would access CSS element to edit the CSS variables inside my stylesheet. I have seen some articles talking about access CSS variable using getElementById. The difficulty is that my element doesn't have any ID - it is the :root element on my stylesheet.

How to access it to handle my CSS variables? Any hint would be great, thanks

4
  • Simply add a css loader and use :root in your style sheet. Commented Jan 19, 2019 at 14:51
  • thanks for your answer, I have tried to use document.:root on React but it doesn't works Commented Jan 19, 2019 at 14:58
  • 1
    :root == html Commented Jan 19, 2019 at 14:59
  • Possible duplicate of Access CSS variable from javascript Commented Jan 19, 2019 at 16:05

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.