Open In App
Related Articles

CSS :root Selector

Improve Article
Save Article
Like Article

The :root selector is used to select all the elements of an HTML Document. This selector covers all the HTML elements or tags. 


:root {
// CSS property



<!DOCTYPE html>
    <title>root selector</title>
        h1 {
            color: White;
        :root {
            background: green;
        body {
            text-align: center;
    <h2>:root selector</h2>
        The root of document is body tag

Output: Supported Browsers: The browser supported by :root selector are listed below:

  • Apple Safari 1.0 and above
  • Google Chrome 1.0 and above
  • Edge 12.0 and above
  • Firefox 1.0 and above
  • Opera 9.5 and above
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 04 Aug, 2023
Like Article
Save Article
Similar Reads
Complete Tutorials