Style the document's root element with CSS

CSSWeb DevelopmentFront End Technology

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

Live Demo

<!DOCTYPE html>
<html>
   <head>
      <style>
         :root {
            background: blue;
            color: white;
         }
      </style>
   </head>
   <body>
      <h1>Heading</h1>
      <p>This is demo text.</p>
   </body>
</html>
raja
Updated on 01-Jul-2020 09:18:45

Advertisements