CSS inherit value examples

CSS inherit value is used to set a css property value to its parent element value. It can be used during debugging (e.g. In Chrome developer tools) or to set a property in third party libraries.

Here is sample code using css inherit

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

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

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