CSS initial value examples

CSS initial value is used to reset a css property to its user-agent value. It can be used during debugging (e.g. In Chrome developer tools) or to reset a property to its initial value in some third party library.

Here is sample code using css initial

<style type="text/css">
h2 {
  color:green;
}
.box > h2 {color:initial};
</style>

<h2>h2 text</h2>
<div class="box">
  <h2>h2 text with color initial</h2>
</div>
refresh

Specification and Browser compatibility

SpecificationStatusCategories
CSS initial valueW3C Candidate RecommendationCSS
Desktop
ChromeFirefoxIEEdgeSafariOpera
Yes 4+ Yes 19+ NoYes 12+ Yes 3.2+ Yes 15+
Mobile
Android ChromeAndroid FirefoxiOS SafariIE MobileOpera Mobile
Yes 47+ Yes 44+ Yes 4.0-4.1+ NoYes 33+
source: caniuse.com

Related links

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

Comments

Click here to write/view comments