What's the difference between these two?

What’s the difference between * { and :root { in CSS?

* means ALL elements. :root means the root of the website.

2 Likes

:root is the root element of the document, which is <html> tag.

* means every element tag.

Wait so if the root isn’t all the elements of the website, what is it? Does * { also include header, etc?

it includes EVERYTHING!

:root selects one element, the root element (normally <html/> but not necessarily – the document may not be HTML)

3 Likes