Global Keywords: inherit, initial, unset, revert, revert-layer and all
The keywords every property accepts: inherit, initial and unset, revert for returning to browser defaults, revert-layer and the new revert-rule for undoing only part of the cascade, and the all property for resetting everything at once, with the traps of each.
kvi5hnuCode Sprout team member8 min readOn this page
Every CSS property, whatever values it normally takes, also accepts a few global keywords. They don't describe a value directly. Instead they tell the browser where to get one: from the parent, from the specification, or from an earlier step of the cascade. They're the tools for undoing styles.
| Keyword | Takes the value from |
|---|---|
inherit | the parent element |
initial | the property's initial value in the specification |
unset | the parent if the property inherits, otherwise the initial value |
revert | the cascade, as if your stylesheets (the current origin) didn't set it |
revert-layer | the cascade, as if the current cascade layer didn't set it |
revert-rule | the cascade, as if the current rule didn't set it |
They're keywords, so they must stand alone: margin: 0 inherit is invalid. They can't be mixed with other values, and they can't appear inside functions.
inherit
inherit makes an element take its parent's computed value, even when a rule would otherwise set a value directly:
.site-footer { color: #f4efe6; background: #3a2a1e; }
.site-footer a { color: inherit; } /* beat the browser's blue link color */
It's the fix for the problem from article 16, where the browser's own rules for links and form controls block inheritance. It also works on properties that don't inherit, although that's rarely useful: border: inherit copies the parent's border.
initial
initial sets the property to its initial value, the default written in the specification for that property:
.card h2 { font-weight: initial; } /* normal */
.panel { background-color: initial; } /* transparent */
The trap is that the initial value belongs to the property, not to the element:
display: initialisinline, for every element, including<div>and<li>.text-decoration: initialon a link isnone, not the underline it normally has.font-size: initialismedium(16px by default), whatever the parent's size is.color: initialisCanvasText, normally black, which ignores the parent's color.
So initial resets to what CSS defines, not to "what this element looked like before my styles". For that, use revert.

The two middle panels are the trap: neither keyword knows that this element is a div, so both give it display's initial value, inline.
unset
unset behaves like inherit for inherited properties and like initial for the others. It's the closest thing to "as if nothing set this property", ignoring the browser's defaults too:
.link-like-button {
color: unset; /* inherited property: inherit */
background-color: unset; /* not inherited: initial, transparent */
border: unset; /* none */
}
unset is most useful with all (below), to strip an element of every style.
revert
revert rolls the value back to what it would be if the current origin had no rules for it. In your stylesheets, the current origin is the author origin, so revert returns to the user's styles if there are any, and otherwise to the browser's default styles:
.prose ul { list-style: revert; padding-inline-start: revert; } /* bullets back after a reset */
.card h2 { display: revert; } /* block, the browser's default for h2 */
That makes revert the right keyword for "undo my styles". Unlike initial, it knows that a <div> is a block and a link is underlined.
.site { color: #2f7d4f; font-family: system-ui, sans-serif; }
a { color: #8a3b12; text-decoration: none; font-weight: 700; }
.initial a { color: initial; text-decoration: initial; }
.unset a { color: unset; text-decoration: unset; }
.revert a { color: revert; text-decoration: revert; }
p { margin: 0.4rem 0; }
font-weight isn't reverted in any of the three, so every link stays bold. Each keyword applies only to the property it's set on.
If revert is used in the browser's default stylesheet or in a user stylesheet, it rolls back further, to the previous origin.
revert-layer
revert-layer rolls the value back to what it would be if the current cascade layer had no rules for it. The value then comes from earlier layers, and if none of them set it, from the browser's defaults:
@layer base, components;
@layer base {
a { color: #8a3b12; }
}
@layer components {
.nav a { color: white; }
.nav a.plain { color: revert-layer; } /* back to the base layer's #8a3b12 */
}
It's how a component layer can say "let the base styles decide here" without repeating their values. Outside any layer, revert-layer rolls back to the layered styles. Article 20 covers layers.
revert-rule
revert-rule is the newest keyword, in all browsers since September 2026. It rolls the value back to what it would be if the current rule didn't exist, so the next rule down in the cascade decides:
.button { background: #8a3b12; color: white; }
.button.ghost { background: transparent; color: #8a3b12; }
.button.ghost:disabled { background: revert-rule; color: revert-rule; }
/* the disabled ghost button gets the .button.ghost values, as if this rule weren't there */
That's useful for exceptions: a more specific rule can hand some properties back to the rules below it without repeating their values. Because it ignores the whole rule, a value set earlier in the same rule is ignored too: color: red; color: revert-rule; doesn't produce red.
The all property
all sets every property to a global keyword at once. It accepts only global keywords:
.widget-root { all: unset; } /* strip everything, then style from scratch */
.prose-reset { all: revert; } /* back to the browser's defaults */
-
allcovers every property exceptdirection,unicode-bidiand custom properties. Custom properties survive, so a component reset withallcan still be themed. -
all: unsetalso removes the browser's defaults, includingdisplay. A<div>withall: unsetbecomes inline. Set the properties you need after it, in the same rule or later:cssbutton.icon-button { all: unset; /* no border, background, padding or font */ display: inline-grid; place-items: center; cursor: pointer; } button.icon-button:focus-visible { outline: 2px solid #8a3b12; } /* restore a focus ring */ -
With
all: unset, the button above also loses its default focus outline. Always add a visible focus style back. Its role as a button is HTML, though, so it stays keyboard-accessible. -
all: initialresets inherited properties too, so text getsfont-size: medium, black color and the default font. It's a way to isolate a widget from the page's inherited styles.

all: unset is the usual starting point for a custom control: it keeps the inherited font and color, so you only add the box you want. all: revert is the way back to the native look.
Where keywords sit in the cascade
The global keywords are ordinary values for the cascade: a declaration such as color: inherit competes with others by origin, layer, specificity and order like any other. Only after it wins does the browser work out what it means. So .footer a { color: inherit; } only works if it beats the other color rules for those links.
What's current
inherit,initial,unset,revertandallhave worked in all browsers since 2020.revert-layeris Baseline since March 2022.revert-rulearrived in Firefox 150, Chrome 148 and Safari 27, making it Baseline newly available since September 2026. Check support before relying on it for important styles.
Common questions
What's the difference between initial and revert?
initial uses the property's default from the specification, the same for every element. revert uses what the browser's stylesheet gives that element. For display on a <div>, initial gives inline and revert gives block.
Is display: initial a way to undo display: none?
Not usually, because it gives inline. Use display: revert to get the element's natural display back, or set the value you want explicitly.
What does all: unset do to a button?
It removes everything: border, background, padding, font, cursor and the browser's focus ring, and makes it inline. The button still behaves as a button, but you have to restyle it, including a visible focus style.
Does all reset custom properties?
No. Custom properties, direction and unicode-bidi are excluded.
When would I use unset instead of revert?
When you want the browser's defaults gone too, for example when building a custom control from a native element. Use revert when you want to keep the browser's sensible defaults, such as bullets on lists or margins on paragraphs.
Summary
- Every property accepts the global keywords, alone as the whole value.
inherittakes the parent's value, andinitialthe specification's default for the property.unsetinherits inherited properties and resets the others to their initial values.revertundoes your styles, returning to the browser's defaults. It's usually what "reset this" means.revert-layerundoes the current cascade layer, andrevert-ruleundoes the current rule.allapplies a keyword to every property except custom properties,directionandunicode-bidi.display: initialis alwaysinline, andall: unsetremoves focus outlines, so restore what you need.
Practice questions
A reset removed list bullets with the rule below. In article text, you want lists to look like the browser's defaults again. Write the rule.
ul { list-style: none; padding: 0; }
Answer
.prose ul { list-style: revert; padding: revert; }
revert goes back to the browser's defaults for those properties. initial would give list-style: disc outside none, which is the same in this case, but the padding would be 0, not the browser's indentation.
What's the display of <li> with display: initial, and with display: revert?
Answer
initial gives inline, the initial value of display. revert gives list-item, from the browser's stylesheet, so the marker is shown.
Why might this rule be a bad idea?
.card * { all: unset; }
Answer
It strips every property from every element in the card, including inherited ones: headings and paragraphs lose their margins and sizes, everything becomes inline, links lose their color and underline, and buttons and inputs lose their borders and focus outlines. You'd have to restyle everything, including focus states.
Where does the color in this rule come from?
@layer theme {
.alert { color: revert-layer; }
}
Answer
From the cascade as if the theme layer didn't set color for that element: from earlier layers, and if no earlier layer sets it, from the browser's defaults or user styles. For color, that usually means it inherits from the parent.
Previous: The Cascade: Origins, !important, Inline Styles and Source Order
Next: Shorthand Properties: How They Reset Values and the Order of Their Parts

More in CSS Course
Quiz: CSS Delicate Details
Twenty-five questions on the edge cases that surprise experienced developers: invalid custom properties, shorthands that reset values, layer order with !important, containing blocks, margin collapsing, specificity of :is() and :where(), intrinsic minimum sizes, and more, each checked in Chrome.
Quiz: CSS Interview Questions
Thirty front-end interview questions: cascade, specificity and layers, box model and margin collapsing, stacking contexts, positioning, flexbox and grid, responsive design, custom properties, performance, accessibility, modern selectors and architecture.
Quiz: CSS Course Final Exam
Thirty questions across the whole CSS course: syntax and error handling, selectors, the cascade and layers, values and units, color, the box model, backgrounds, positioning, flexbox, grid, responsive design, typography, generated content, effects, transforms, motion and architecture.
Quiz: CSS Architecture, Tooling and Debugging (CSS Part 17)
Twenty questions on modular CSS and BEM, layering a stylesheet, design tokens and theming, pattern libraries and safe refactoring, preprocessors and build tools, the at-rules reference, and debugging common CSS problems.
Discussion
Sign in to ask a question or share what you learned.