CSS all Property

Beginner
⏱️ 6 min read
📚 Updated: Jun 2026
🎯 4 Examples
Reset & Inheritance

What You’ll Learn

The all property is a CSS shorthand that lets you reset or inherit every CSS property on an element with a single declaration. It is especially useful when you need a clean slate or want a child to fully match its parent styling.

01

Global Reset

Change every property at once.

02

Syntax

One keyword, one rule.

03

initial

Return to spec defaults.

04

inherit

Adopt parent styles.

05

unset

Smart reset behavior.

06

When to Use

Components, widgets, resets.

Definition and Usage

The all CSS property is a shorthand that resets or sets all of an element’s CSS properties to a single keyword value. Instead of writing many separate reset rules, you can apply all: initial, all: inherit, or all: unset in one line.

This is helpful when embedding third-party content, isolating a component from surrounding styles, or quickly undoing inherited styling on a nested element.

💡
Beginner Tip

Think of all as a master switch. initial wipes styles back to browser defaults, inherit copies the parent, and unset chooses the smarter option for each property.

📝 Syntax

Apply all like any other CSS property. The value is always one global keyword:

syntax.css
selector {
  all: initial | inherit | unset | revert | revert-layer;
}

Basic Example

all-initial.css
.reset-style {
  all: initial;
}

Syntax Rules

  • all accepts global keywords, not individual values like colors or lengths.
  • It affects all standard CSS properties except unicode-bidi and direction.
  • CSS custom properties (--variables) are not reset by all.
  • After using all: initial, you may need to re-add properties like display for layout.
  • Use revert or revert-layer in modern browsers when you want browser-default styling instead of spec initial values.

⚡ Quick Reference

QuestionAnswer
Applies toAll elements
InheritedNo
AnimatableNo
Most common valuesinitial, inherit, unset
Common useResetting embedded content or isolating a component

Default Value

Elements do not use the all property by default. Each CSS property keeps its own normal initial or inherited value until you write a rule. You only see the effect of all when you explicitly set it on a selector.

💎 Property Values

These global keywords control how every CSS property on the element is treated.

ValueExampleMeaning
initialall: initial;Resets every property to its CSS specification initial value
inheritall: inherit;Makes every property inherit from the parent element
unsetall: unset;Uses inherit for normally inherited properties and initial for the rest
revertall: revert;Rolls properties back to the browser stylesheet level
revert-layerall: revert-layer;Rolls back to the previous cascade layer, if layers are used
initial

The child starts with bold red underlined styling, then all: initial removes those custom styles and returns to browser defaults.

Parent context

Reset with all: initial

Custom color, weight, and underline are cleared.

inherit

The child had its own red styling, but all: inherit makes it match the parent’s blue serif text instead.

Parent: Georgia, dark blue, bold

Child inherits everything

Font, color, and weight come from the parent.

unset

all: unset is a balanced reset: inherited properties like color follow the parent, while non-inherited properties return to initial values.

Parent: Georgia, dark blue, bold

Smart reset with all: unset

Useful when you want a softer reset than initial.

initial vs inherit vs unset

KeywordWhat it doesBest for
initialEvery property goes to its CSS defaultHard resets and blank-slate components
inheritEvery property copies the parentNested content that should fully match a theme
unsetInherited props inherit; others reset to initialFlexible resets that keep natural text inheritance

What Properties Does all Affect?

The all shorthand applies to all CSS properties except:

  • unicode-bidi
  • direction

It does not remove CSS custom properties you defined with --name. After a reset, you can still reference variables from ancestor elements unless you override them separately.

👀 Live Preview

Compare a normal styled paragraph with one reset using all: initial:

Normal paragraph

This paragraph keeps custom red styling.

Reset paragraph

This paragraph was reset with all: initial.

Examples Gallery

Try all with initial, inherit, unset, and a practical component reset.

📚 Reset Keywords

These examples show the three most common all keywords beginners use when clearing or copying styles.

Example 1 — Reset All Styles with initial

Remove custom styling from a paragraph and return it to browser default values.

all-initial.html
<style>
  p {
    color: red;
  }
  .reset-style {
    all: initial;
  }
</style>

<p>This turns red.</p>
<p class="reset-style">
  This paragraph has all styles reset to initial values.
</p>
Try It Yourself

How It Works

The first paragraph keeps the global p { color: red; } rule. The second paragraph uses all: initial, so custom color and other inherited styling are cleared.

Example 2 — Inherit All Styles from a Parent

Make a child element fully adopt the parent’s font and color styling.

all-inherit.html
<style>
  .parent {
    font-family: Arial, sans-serif;
    color: darkblue;
  }
  .child {
    all: inherit;
  }
</style>

<div class="parent">
  <p class="child">
    This paragraph inherits its styles from its parent.
  </p>
</div>
Try It Yourself

How It Works

Instead of setting font-family and color separately on the child, all: inherit copies every inheritable property from .parent.

Example 3 — Smart Reset with unset

Use unset when you want inherited text properties to stay natural while other properties reset.

all-unset.css
.card {
  color: #0f172a;
  font-family: Georgia, serif;
}

.card .note {
  margin: 2rem;
  border: 4px solid orange;
  all: unset;
  display: block;
}
Try It Yourself

How It Works

unset removes the orange border and large margin while letting text-related properties behave more naturally inside the card.

🛠 Real-World Usage

Use all to isolate embedded widgets or third-party markup from surrounding page styles.

Example 4 — Isolate a Widget from Page Styles

Reset a button inside a heavily styled page so it starts from a predictable baseline.

all-widget.html
<style>
  button {
    background: purple;
    color: white;
    padding: 1rem 2rem;
    border-radius: 999px;
  }
  .widget button {
    all: initial;
    display: inline-block;
    padding: 0.5rem 1rem;
    border: 1px solid #64748b;
    cursor: pointer;
  }
</style>

<button>Site button</button>
<div class="widget">
  <button>Widget button</button>
</div>
Try It Yourself

How It Works

The widget button ignores the global purple pill styling because all: initial clears inherited and applied styles first, then you rebuild only what the widget needs.

🧠 How the all Property Works

1

You choose one global keyword

Write all: initial, inherit, or unset on a selector.

Keyword
2

CSS applies it to every property

The browser updates all standard longhand properties on that element at once, except unicode-bidi and direction.

Cascade
3

You rebuild only what you need

After a hard reset, add back layout and design rules like display, padding, or borders.

Follow-up rules
=

Clean, predictable styling

One declaration gives you a controlled reset or inheritance strategy without listing dozens of properties.

Universal Browser Support

The all property is supported in all modern browsers. Keywords like revert and revert-layer have slightly newer support.

Baseline · Modern browsers

Reset styles reliably in today’s browsers

Chrome, Firefox, Safari, Edge, and Opera support initial, inherit, and unset through the all shorthand.

97% Modern browser support
Google Chrome37+ · Desktop & Mobile
Full support
Mozilla Firefox27+ · Desktop & Mobile
Full support
Apple Safari9.1+ · macOS & iOS
Full support
Microsoft Edge79+ · Chromium
Full support
Opera24+ · Modern versions
Full support

Newer keywords

revert and revert-layer are supported in current browsers but are newer than the core shorthand.

💻
Internet Explorer No support for all
None
all property 97% supported

Bottom line: Use all confidently in modern projects, but test hard resets on interactive elements like buttons and links.

Conclusion

The all property is a powerful CSS shorthand for resetting or inheriting every property at once. It saves time when you need a clean baseline or want nested content to fully match a parent theme.

For beginners, remember the three main keywords: initial for a hard reset, inherit for copying the parent, and unset for a smarter mixed reset.

💡 Best Practices

✅ Do

  • Use all: unset when you want a softer reset than initial
  • Re-add essential properties like display after a hard reset
  • Scope resets to a component class such as .widget
  • Test buttons, links, and form controls after using all
  • Prefer targeted resets when only a few properties need changing

❌ Don’t

  • Apply all: initial globally to every element on a page
  • Assume CSS variables are cleared by all
  • Forget that initial is not always the same as browser default styling
  • Use all when resetting one or two properties would be clearer
  • Skip visual testing in the browsers your users actually use

Key Takeaways

Knowledge Unlocked

Five things to remember about all

Use these points when resetting or inheriting styles.

5
Core concepts
🔄02

initial

Hard spec defaults.

Reset
🔁03

inherit

Copy parent styles.

Cascade
04

unset

Smart mixed behavior.

Flexible
💡05

Rebuild After

Add display and layout back.

Careful

❓ Frequently Asked Questions

The all property is a shorthand that applies one keyword to every CSS property on an element at the same time. It is useful for resetting styles or forcing inheritance from a parent.
initial resets every property to its spec default. unset is smarter: inherited properties behave like inherit, and non-inherited properties behave like initial.
Use it when a child element should fully adopt the parent styling context, such as embedding content inside a themed container.
It affects all standard CSS properties except unicode-bidi and direction. Custom properties (CSS variables) are not reset by all.
Yes, but use it carefully. all: initial can remove useful defaults like display on buttons, so test the result before applying it broadly.

Practice in the Live Editor

Open the HTML editor, try all: initial, and compare the reset with normal styling instantly.

HTML Editor →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

5 people found this page helpful