Computer >> Computer tutorials >  >> Programming >> CSS

Style the document's root element with CSS


To style document’s root element, use the CSS: root selector.

Example

You can try to run the following code to implement the: root Selector

<!DOCTYPE html>
<html>
   <head>
      <style>
         :root {
            background: blue;
            color: white;
         }
      </style>
   </head>
   <body>
      <h1>Heading</h1>
      <p>This is demo text.</p>
   </body>
</html>