Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

CSS | :root Selector

  • Last Updated : 04 Dec, 2018

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


Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.

:root {
    // CSS property


<!DOCTYPE html>
        <title>root selector</title>
            h1 {
            :root {
                background: green;
            body {
        <h2>:root selector</h2>
        <p>The root of document is <body> tag</p>


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

  • Apple Safari 3.2
  • Google Chrome 4.0
  • Firefox 3.5
  • Opera 9.6
  • Internet Explorer 9.0
My Personal Notes arrow_drop_up
Recommended Articles
Page :