Widely availableSupported across all major browsers. Safe to use in production.

Overview

The inherit keyword resets any CSS property to the computed value of that property from the parent element.

Browser support

Feature Desktop Mobile
Chrome
Edge
Firefox
Safari
Chrome Android
Safari iOS
global_keywords
1
12
1
1
18
1

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.

1
12
1
1
18
1
1+Supported (version) Not supported Has note Sub-feature descriptions sourced from MDN Web Docs (CC BY-SA 2.5)

Syntax

CSS
.child {
  border: inherit;
  color: inherit;
  font-size: inherit;
}

Live demo

color: inherit

CSS Color: inherit demo.

PreviewFullscreen

border: inherit

CSS Border: inherit demo.

PreviewFullscreen

font-size: inherit

CSS Font-size: inherit demo.

PreviewFullscreen

Use cases

  • Using inherit

    The inherit keyword resets any CSS property to the computed value of that property from the parent element.

Cautions

  • May not be supported in older browsers.

Accessibility

  • Make sure visual changes are conveyed appropriately to assistive technology.

Powered by web-features