CSS :root Selector
Example
Set the background color for the HTML document:
:root
{
background: #ff0000;
}
Try it Yourself »
Definition and Usage
The :root
selector
matches the document's root element.
In HTML, the root element is always the html element.
Version: | CSS3 |
---|
Browser Support
The numbers in the table specifies the first browser version that fully supports the selector.
Selector | |||||
---|---|---|---|---|---|
:root | 4.0 | 9.0 | 3.5 | 3.2 | 9.6 |
CSS Syntax