CSS inheritance
The CSS rule that some properties, mostly text-related ones like color and font, pass their value from a parent to its descendants unless overridden.
In more detail
Layout properties such as width, margin and display are not inherited. Custom properties are inherited, which is what makes theming by scope work.
Related terms
- CSS-wide keywords — The values inherit, initial, unset and revert, which work on any CSS property to control inheritance explicitly.
- CSS cascade — The CSS process that decides which of several competing rules sets a property on an element.
- CSS custom property — A property you define yourself with a double-hyphen name, such as --brand: #0066cc, and read elsewhere with var(--brand).
Taught in
- CSS Parsing, The CSSOM And The Render Tree — Frontend Architecture & Web Platform
- The Cascade Algorithm: Specificity, Inheritance And Source Order — Frontend Architecture & Web Platform
- CSS Custom Properties: Scoping, Fallbacks And Theming — Frontend Architecture & Web Platform