asp.net.ph

Skip Navigation LinksAbakada: Back to Basics > Language References > CSS Properties > Pseudo-Classes > root Pseudo-class

:root Pseudo-class


Represents the root element of a document.

Syntax

:root { property: value; }

Possible Values

property Any valid CSS property.
value Any of the range of values available to the corresponding property.

Remarks

The :root pseudo-class applies styles to the root element of a tree representing the document.

In HTML, :root represents the <html> element and is identical to the selector html.

The syntax for using the :root pseudo-class is straightforward. Nothing precedes the pseudo-class.

For example, to change the background color of the entire page:

:root { background-color: ghostwhite }

:root can be helpful for declaring styles that will apply to the entire page.

:root {
   font: 12pt verdana, arial, sans-serif;
   margin-left: 20px; margin-right: 20px;
   background: ghostwhite;
}

Example

The following demonstrates use of the :root pseudo-class in an embedded stylesheet to set styles for the entire page.

 Show me 

External References

See Also

html



Check out related books at Amazon

© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note