CSS: Selector: Match Root Element

By Xah Lee. Date: . Last updated: .

Match Root Element (Element with No Parent)

:root

Match the HTML: the Root Element .

/* make all text red */
:root { color: red; }

This is often used when using CSS Variable .

CSS, Selectors

The Root Element