tadam logo
@keyframesanimationanimation-nameanimation-durationanimation-timing-functionanimation-delayanimation-iteration-countanimation-directionanimation-play-statebackgroundbackground-attachmentbackground-colorbackground-imagebackground-positionbackground-repeatbackground-clipbackground-originbackground-sizeborderborder-bottomborder-bottom-colorborder-bottom-styleborder-bottom-widthborder-colorborder-leftborder-left-colorborder-left-styleborder-left-widthborder-rightborder-right-colorborder-right-styleborder-right-widthborder-styleborder-topborder-top-colorborder-top-styleborder-top-widthborder-widthoutlineoutline-coloroutline-styleoutline-widthborder-bottom-left-radiusborder-bottom-right-radiusborder-imageborder-image-outsetborder-image-repeatborder-image-sliceborder-image-sourceborder-image-widthborder-radiusborder-top-left-radiusborder-top-right-radiusbox-shadowoverflow-xoverflow-yoverflow-stylerotationrotation-pointopacityheightmax-heightmax-widthmin-heightmin-widthwidthbox-alignbox-directionbox-flexbox-flex-groupbox-linesbox-ordinal-groupbox-orientbox-packfontfont-familyfont-sizefont-stylefont-variantfont-weight@font-facefont-size-adjustfont-stretchcontentcounter-incrementcounter-resetquotesgrid-columnsgrid-rowstargettarget-nametarget-newtarget-positionlist-stylelist-style-imagelist-style-positionlist-style-typemarginmargin-bottommargin-leftmargin-rightmargin-topcolumn-countcolumn-fillcolumn-gapcolumn-rulecolumn-rule-colorcolumn-rule-stylecolumn-rule-widthcolumn-spancolumn-widthcolumnspaddingpadding-bottompadding-leftpadding-rightpadding-topbottomclearclipcursordisplayfloatleftoverflowpositionrighttopvisibilityz-indexpage-break-afterpage-break-beforepage-break-insideborder-collapseborder-spacingcaption-sideempty-cellstable-layoutcolordirectionletter-spacingline-heighttext-aligntext-decorationtext-emphasistext-indenttext-transformvertical-alignwhite-spaceword-spacinghanging-punctuationpunctuation-trimtext-justifytext-outlinetext-overflowtext-shadowtext-wrapword-breakword-wraptransformtransform-origintransform-styleperspectiveperspective-originbackface-visibilitytransitiontransition-propertytransition-durationtransition-timing-functiontransition-delayappearancebox-sizingiconnav-downnav-indexnav-leftnav-rightnav-upoutline-offsetresize
Did you find an error in the text?
Select this with mouse and press
Ctrl + Enter
Xhtml.co.il Check Spelling
Orphus system

CSS3 :root Selector

Example

Set the background color for the HTML document
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style> 
:root
{
  background:#ff0000;
}
</style>
</head>
<body>

<h1>This is a heading</h1>

</body>
</html>

The output of the code above will be:

Definition and Usage

The :root selector matches the document’s root element.

In HTML, the root element is always the html element.

Browser Support

The :root selector is supported in all major browsers, except IE8 and earlier.

Was this information helpful?
   

Comments