CSS :root Pseudo-class
Example
Set a background color and padding for the document's root element:
:root
{
background-color: red;
padding: 30px;
}
Try it Yourself »
Definition and Usage
The CSS :root pseudo-class
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 pseudo-class.
| Pseudo-class | |||||
|---|---|---|---|---|---|
| :root | 1 | 12 | 1 | 1 | 9.6 |
CSS Syntax