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;
}
</style>

<dive>div1</div>
<dive>div2</div>
refresh

Specification

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

Comments

Click here to write/view comments