What is the :root in css?

Hello, as I went through the FCC curriculum some exercises had something called :root. I’m wondering what this is. Could someone explain?

Hello there.

Do you have a question?

If so, please edit your post to include it in the Tell us what’s happening section.

The more information you give us, the more likely we are to be able to help.

Hello, as I went through the FCC curriculum some exercises had something called :root. I’m wondering what this is. Could someone explain?

the name root refers to it being the base of the html tree, it’s usually just used to declare variables so that they are available to all the other elements

Is this important to know or not?

it’s where you declare css variables, there is nothing else to know there

also, don’t worry about memorizing everything, you can always consult documentation - for example the MDN I linked above, or devdocs.io

1 Like