:root
In this chapter you will learn:
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> <!--from j av a 2s .com-->
<html>
<head>
<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>
Next chapter...
What you will learn in the next chapter:
Home » HTML CSS Tutorial » CSS Selector Reference