CSS :root

The :root pseudo-class represents an element that is the root of the document. In case of HTML, it is html element.

Example – css :root

In this example :root selector is being used to chage background color of html element (hence whole document).

<style type="text/css">
:root {
  background-color: lightblue;



Share this article: share on Google+ share on facebook share on linkedin tweet this submit to reddit


Click here to write/view comments