CSS: Property inheritance
Some properties are naturally inherited
by CSS spec, some properties are inherited, others are not.
sample of properties with natural inheritance:
colorfont-familyfont-sizetext-alignline-heightvisibility
sample of properties with no natural inheritance:
bordermarginpaddingbackground
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
- CSS: @media query
- CSS: variable (custom property)
- CSS: calc()
- CSS: all (reset, revert, default)
- CSS: inherit, initial, reset, revert, revert-layer
- CSS: nesting syntax
- CSS: Computed Style
- CSS: Browser Default Style Sheet (2025-12)