CSS inherit Keyword

CSS inherit keyword applies computed value of the property from its parent element.

CSS inherit keyword applied to any CSS property. The inherit keyword can be used for reinforces the default behavior, and override another rule.


The following table outline the usages and version history of inherit keyword.

Applies to: all elements
Version: CSS2
JavaScript Syntax: object.style.property = "inherit"


Here is a syntax for the CSS inherit keyword

property: inherit;


<!DOCTYPE html>
  <title>CSS inherit Keyword</title>
    span {
      color: red;
    p {
      color: blue;
    p span {
      color: inherit;
      border: 1px solid #000;
    This is a paragraph text. <span>This text color is inherit from its parent.</span> This is a paragraph text.

  <span>This is a span element</span>

Run it...   »

Browser Compatibility

  • Google Chrome 1+
  • Mozilla Firefox 1+
  • Internet Explorer 8+
  • Opera 4+
  • Safari 1+

Note: The inherit keyword is not supported in IE7 and earlier version.

Note: Here details of browser compatibility with version number may be this is bug and not supported. But recommended to always use latest Web browser.