
The easiest way to understand initial, inherit, and unset is to ask one question first: does this CSS property normally inherit? Text-related properties often inherit. Layout, spacing, background, positioning, and transform usually do not.
unset depends on that inheritance behavior, which is why it feels confusing when learned only from definitions.
Quick comparison
| Keyword | Meaning | Best use |
|---|---|---|
initial |
Reset to the property's initial value | When you explicitly want the spec default for that property |
inherit |
Force the value from the parent | When the child must match the parent |
unset |
Behaves like inherit for inherited properties, otherwise like initial |
When you want a neutral reset based on the property's normal behavior |
initial does not mean "go back to the browser's visible default style." It means the property's initial value. inherit does not mean "normal inheritance"; it forces inheritance even for properties that normally do not inherit.
Properties that usually inherit
Text and presentation properties commonly inherit:
colorfont-familyfont-sizefont-weightline-heighttext-alignletter-spacingword-spacingvisibilitycursor
That is why this works naturally:
article {
color: #d4d2cb;
line-height: 1.8;
}
Most child text will follow those values without repeating them on every element.
Properties that usually do not inherit
Layout and box-model properties usually do not inherit:
widthheightmarginpaddingborderdisplaypositiontop,right,bottom,leftbackgroundoverflowtransformz-index
This is a good thing. If every child inherited display: flex, position: relative, or margin, layouts would become hard to control.
The difference with color
color is inherited:
.parent {
color: royalblue;
}
.a {
color: initial;
}
.b {
color: inherit;
}
.c {
color: unset;
}
Result:
.areturns to the initial color value..buses the parent'sroyalblue..cbehaves likeinherit, becausecoloris normally inherited.
The difference with margin
margin-left is not normally inherited:
.parent {
margin-left: 40px;
}
.a {
margin-left: initial;
}
.b {
margin-left: inherit;
}
.c {
margin-left: unset;
}
Result:
.aresets to the initial value..bforcibly receives40pxfrom the parent..cbehaves likeinitial, becausemargin-leftis not normally inherited.
This is the core mental model for unset.
When to use inherit
Use inherit when the child should intentionally match the parent:
.card {
border-radius: 16px;
}
.card img {
border-radius: inherit;
}
This avoids duplicating 16px and keeps future changes aligned.
Icons often use a related pattern:
.button {
color: white;
}
.button svg {
fill: currentColor;
}
currentColor lets the icon follow text color.
When to use initial
Use initial when you want to cut off an inherited or previously applied value:
.editor {
text-align: center;
}
.editor code {
text-align: initial;
}
Use it deliberately. The initial value may not match what you think of as "browser default styling."
When to use unset
unset works well in neutral reset code:
.button-reset {
all: unset;
}
It saves you from manually deciding each property's inheritance behavior. The tradeoff is readability: readers still need to understand whether the property normally inherits.
Related FreeMac guides
- For rem and root font size, read What is rem in CSS? Why 1rem Often Equals 16px.
- For z-index issues, read Why z-index Fails: Understanding CSS Stacking Context.
- For animation performance, read Reflow and Repaint: Why CSS Animations Get Janky.
Continue reading
CSS 3D: perspective and transform-style Explained
Understand CSS 3D transforms through perspective, transform-style: preserve-3d, translateZ, rotateY, flattening, and parent-child 3D scene setup.
7 min readReflow and Repaint: Why CSS Animations Get Janky
Understand browser rendering steps, reflow, repaint, compositing, and why transform and opacity are usually better animation targets than width, height, top, or left.
7 min readWhy z-index Fails: Understanding CSS Stacking Context
Understand why z-index: 9999 can still appear behind another element by learning stacking contexts, parent boundaries, transform, opacity, isolation, and portal-style fixes.
Subscribe to FreeMac
Weekly picks: free Mac software reviews, trusted source updates, alternatives, and low-friction guides.