Search notes:

CSS pseudo class selector :root

The :root pseudo class selector matches a document tree's root element which is the html element in HTML documents.
Because the :root pseudo class selector has higher specifity than the html element, the text of Not within div is red (as specified by :root) rather than blue in the following example.
The specified font-size in the html selector in inherited from div elements.
<html>
<head>
<style>

:root {
   color: red;
}

html {
   color: blue;
   font-size: 20px
}

div {
   color: green;
}

</style>
</head>
<body>

<div>Within div</div>

Not within div

</body>
</html>
Github repository about-css, path: /selectors/pseudo-classes/root.html

See also

document.documentElement

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:51 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(51): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(66): id_of(Object(PDO), 'uri', '/notes/developm...') #2 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1788534275, '216.73.217.21', 'Mozilla/5.0 App...', NULL) #3 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/web/CSS/selectors/pseudo-classes/root(70): insert_webrequest() #4 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 51