CSS inherit keyword

Example

Set the text color of the <span> element to blue, except within elements that have the class="extra":

span {
  color: blue;
}
.extra span {
  color: inherit;
}

Try it yourself

Definition and Usage

The 'inherit' keyword specifies that the property should inherit its value from its parent element.

The 'inherit' keyword can be used for any CSS property and any HTML element.

Version: CSS3
JavaScript Syntax: object.style.property="inherit"

Browser Support

The numbers in the table indicate the first browser version that fully supports this property.

keyword Chrome IE Firefox Safari Opera
inherit 1.0 8.0 1.0 1.0 4.0

CSS Syntax

property: inherit;

Related Pages

CSS initial keyword:initial keyword