CSS: Property inheritance

By Xah Lee. Date: . Last updated: .

Some properties are naturally inherited

by CSS spec, some properties are inherited, others are not.

sample of properties with natural inheritance:

sample of properties with no natural inheritance:

When a property have natural inheritance

it means, when a CSS property is not set, it gets its value from parent element.

When a property does not have natural inheritance

it means, when a CSS property is not set, its value is the initial value.

Setting a property to inherit

regardless of the property's natural inheritance, you can always set it to inherit.

.x {
 margin: inherit;
}

CSS special property and values

CSS. misc, advanced