The inherit CSS keyword

❮ CSS References

Meaning

The inherit CSS keyword causes the element to take the computed value of the property from its parent element.

It can be applied to any CSS property, including the CSS shorthand property all.

For inherited properties, this reinforces the default behavior, and is only needed to override another rule.

Note: Inheritance is always from the parent element in the document tree, even when the parent element is not the containing block.







Browser Support

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




Status







Example

Example

#parent {
  width: 300px;
  color: red;
  font-size: 24px;
}

#child {
  width: inherit;
  color: initial;
  font-size: inherit;
}



See also:

❮ CSS References