HTML: the Root Element

By Xah Lee. Date: . Last updated: .

What is Root Element

Why is Root Element Important

It's important because many CSS unit's meaning refers to it.

[see CSS: Length Units]

CSS Syntax for Root Element

In CSS, the root can be specified by:


For example, make all text red:

:root { color: red; }

This is often used when using CSS variables.

[see CSS Variable]