Skip to content

CSS Tutorial CSS Inheritance

CSS unset and revert

Lesson 167 of 182 2 min read By Deepak Paswan Updated Oct 4, 2026

Two more keywords help you undo styles. They are smarter than initial.

unset

unset means:

  • if the property is inherited by default, act like inherit;
  • otherwise, act like initial.
index.html
HTML
<style>
  .card { color: #1a5276; border: 2px solid #d94a00; }
  p { color: #d94a00; border: 1px dashed #999; }
  .card .plain { color: unset; border: unset; }
</style>
<div class="card">
  <p>Orange text with a dashed border.</p>
  <p class="plain">Text inherits the card's blue (color is inherited). The border goes to none (border is not).</p>
</div>

Same keyword, two different results, because of the property’s nature.

revert

revert rolls back to the value that the browser’s default stylesheet (or the user’s) would give. Unlike initial, it takes the browser’s HTML knowledge into account.

index.html
HTML
<style>
  ul { list-style: none; padding: 0; margin: 0; }             /* a site-wide reset */
  .article ul { list-style: revert; padding: revert; margin: revert; }   /* normal lists inside articles */
</style>
<ul><li>A menu item (no bullet)</li></ul>
<div class="article"><ul><li>An article list item (bullet and indent are back)</li></ul></div>

revert restores what the browser itself would do for that tag. For display on a div that is block, while display: initial would give inline.

The all property

all applies a keyword to every property at once: all: unset, all: revert, all: initial. It is a heavy tool:

style.css
JS
.third-party-widget { all: revert; }   /* start this component from browser defaults */

Use it to isolate a component from surrounding CSS, for example when building an embeddable widget.

Quick guide

KeywordResult
inheritUse the parent’s value
initialThe specification’s default
unsetinherit if the property inherits, else initial
revertThe browser’s default style for this element
info
Keywords take part in the cascade
All of these are normal values. They take part in the cascade like any other value, so a more specific rule that sets the property still wins.

In a footer with light text, make every link use exactly the footer’s text color and remove its underline. Do not hard-code a color.

Show a possible solution
style.css
CSS
footer a { color: inherit; text-decoration: none; }