CSS Selector :root
Description
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
Example
<!DOCTYPE HTML>
<html>
<head>
<!--from w ww .j av a 2 s . c om-->
<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>
The code above generates the following result.