CSS/Selectors/pseudo-classes/:root

From W3C Wiki
< CSS‎ | Selectors

Pseudo-classes :root

The :root pseudo-class represents an element that is the root of the document. In HTML, this is always the HTML element.

Syntax

selector:root{ properties }


Example

[style.css]

 :root{
   background-color: #ccc;
 }


[index.html]

<body>
<p>This is a paragraph.</p>
</body>

CSS defines the :root pseudo-class in 6.6.5.1. :root pseudo-class.