CSS3/Selectors/pseudo-classes/:root

From W3C Wiki

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>

The CSS Selectors Level 3 specification defines the :root pseudo-class in 6.6.5.1. :root pseudo-class.