THE WORLD'S LARGEST WEB DEVELOPER SITE

CSS inherit Keyword


Example

Set the text-color for <span> elements to blue, except those inside elements with class="extra":

span {
    color: blue;
}

.extra span {
    color: inherit;
}

Try it yourself »

Definition and Usage

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

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

Version: CSS3
JavaScript syntax: object.style.property="inherit" Try it

Browser Support

The numbers in the table specifies the first browser version that fully supports the inherit keyword.

Keyword
inherit 1.0 8.0  1.0 1.0 4.0

Note: The inherit keyword is not supported in IE7 and earlier. IE8 requires a !DOCTYPE.


CSS Syntax

property: inherit;

Related Pages

CSS initial Keyword: initial keyword



COLOR PICKER

colorpicker

SHARE THIS PAGE






Search w3schools.com:

Translate w3schools.com: