"Inheritance is the silent default. Half your styling 'just worked' because of it; the other half is broken because you didn't know which."
The Per-Property Rule
Every CSS property has a single line in its spec: Inherited: yes or Inherited: no. When a parent has a value and the child has no rule setting it:
- If inherited: the child takes the parent's value.
- If not inherited: the child uses the property's initial (default) value.
You don't have to memorize the full list — but you do need to internalize the categories.
What Inherits By Default
Typography and text-related properties inherit. The cognitive model: setting font-family on <body> should cascade down to every paragraph, heading, list item, link, span inside without writing 50 rules.
color,font(and all its longhand:font-family,font-size,font-weight, etc.)line-height,letter-spacing,word-spacing,text-align,text-indent,text-transform,text-shadowvisibility(yes — set visibility on parent and it hides children too)cursor,quotes,list-style(the list bullets cascade to nested lists)- Custom properties (CSS variables) —
--brand-color: blue;on:rootis visible everywhere - RTL/LTR-related:
direction
What Doesn't Inherit
Layout, box, background, and positional properties don't inherit. The model: you don't want every child to inherit its parent's margin or border or background.
margin,padding,borderwidth,height,min-width,max-width,min-height,max-heightdisplay,position,top/right/bottom/leftbackground(and all its longhand)flex,grid, all the layout propertiestransform,opacity,z-indexoverflow,cursor-inherit(don't confuse withcursorwhich DOES inherit)
The Form Element Exception
Form elements (<input>, <textarea>, <select>, <button>) historically have UA-provided fonts that override the inheritance from <body>. This is why your beautifully-themed text doesn't apply to form inputs by default. The fix:
The Four Universal Values: inherit, initial, unset, revert
Every CSS property accepts these four keywords (plus revert-layer):
inherit— force inheritance from the parent. Useful for properties that don't inherit by default ("I want this padding to match the parent's padding").initial— reset to the property's initial value as defined in the CSS spec. Not the browser's UA-stylesheet value — the spec's initial. (Fordisplay, the initial isinline, not whatever the UA gave the element.)unset— if the property inherits by default, behave asinherit; otherwise behave asinitial. Useful in resets.revert— revert to the value the property would have if no author rules existed (i.e., back to the UA default, or to the user stylesheet if one exists).revert-layer— revert to the value from the previous cascade layer.
all: revert is the cleanest reset for a single element. One declaration, every property restored to UA defaults. Use when embedding third-party content (an iframe-substitute, an editor preview) that needs to render with default styles even inside a heavily-themed site.Custom Properties (CSS Variables) Inherit, And It's A Superpower
This is the one that changes how you write CSS in 2026:
Custom properties (--brand-color, --gap, --radius) inherit through the DOM like text properties do. Define them once at :root and they're visible everywhere. Re-declare on a section and that section's subtree sees the new value. This is how dark mode toggles work in modern CSS — data-theme="dark" on <html> redefines the variables, every descendant picks up the new values via inheritance, no extra rules needed.
When Inheritance Bites You
Three classic confusions:
- "Why is my child element blue?" — you set
coloron an ancestor and forgot it inherits. - "Why doesn't my form input use my font?" — form elements override inherited font with UA defaults; add
input, button, select, textarea { font: inherit; }. - "Why did the link color change after my reset?" — you set
coloron a parent and links inherit it, overriding the browser's default link blue.
Pippa's Note
:root declares --bg, --fg, --accent, etc. [data-theme="dark"] redefines them. Every component reads color: var(--fg), background: var(--bg) — no theme-aware logic anywhere. Switching themes is one attribute change, and inheritance does the rest. Cwk-site's quest colors work the same way: each quest's meta.json palette becomes custom properties on the quest page wrapper, and the components inside inherit them automatically.