The :root
selector selects the root element in the document.
It always returns the html element. The :root
is added by CSS3.
Its format is:
:root
:root { style properties }
:root |
Yes | 9.0 | Yes | Yes | Yes |
An example showing how to use :root CSS selector.
<!DOCTYPE HTML>
<html>
<head>
<!-- ww w . j ava2 s . com-->
<style type="text/css">
:root {
border: thin black solid;
padding: 4px;
}
</style>
</head>
<body>
<a href="http://java2s.com">Visit the java2s.com</a>
<p>I like HTML.</p>
</body>
</html>