Skip to content
Tutorials Center
My learning

Topics

CSS Reference ยท Custom Properties, Cascade and Global Keywords

The all property

Reference for the CSS all property: reset every property at once with initial, inherit, unset, revert or revert-layer, with examples and caveats.

The all property is a shorthand that sets nearly every CSS property of an element to the same global keyword in one declaration. It is mainly used to isolate a component from surrounding styles: reset everything, then build the component's styles back up.

It accepts only the global keywords initial, inherit, unset, revert and revert-layer. It does not touch direction or unicode-bidi (text direction should survive a reset), and it does not touch custom properties.

CSS
.widget { all: unset; }
.isolated { all: initial; font-family: sans-serif; }

Try it

Resetting a link and a box
Isolate then rebuild

Syntax

CSS
all: initial | inherit | unset | revert | revert-layer;
  • Initial value: none (it is a shorthand and has no value of its own)
  • Applies to: all elements and pseudo-elements
  • Inherited: no
  • Animatable: no
  • Computed value: as specified

Values

Value Description
initial Every property gets its specification initial value. A <div> becomes display: inline, because the browser's default style sheet is ignored.
inherit Every property takes the parent's computed value.
unset Inherited properties inherit; the rest use their initial value.
revert Rolls back to the previous origin: the browser's defaults (or user styles) instead of the page's author styles. Usually the most natural reset for a component.
revert-layer Rolls back to the previous cascade layer.

Usage notes

  • Declaration order matters. all is a shorthand, so later declarations in the same rule override it and earlier ones are wiped. Put all first.
  • Specificity still rules. Another rule with higher specificity that sets color still wins over all: unset in a weaker selector.
  • all: initial surprises. Elements lose their default display, so write display: block again where needed.
  • Prefer revert for components. It keeps buttons, lists and headings looking like native elements.
  • Custom properties survive. Variables are not reset by all, so theme tokens keep working.
  • Heavy hand. Resetting everything makes you restyle fonts and spacing; use it for small isolated pieces, not entire pages.

Browser support

Supported in all current browsers.