Role of CSS :root Selector

CSSWeb DevelopmentFront End Technology

Use the CSS : root selector to style document’s root element.

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
Published on 09-May-2018 11:51:05
Advertisements