CSS has two ways to target the root element of an HTML document - the :root pseudo-class and the html selector. The :root selector has a higher specificity than thehtml selector. This is because :root is a pseudo- class selector, while html is a type selector.

1m read timeFrom 30secondsofcode.org
Post cover image
Table of contents
Selector specificityTargeting the root element

Sort: