W3docs

CSS all Property

The all is a CSS property which sets all the properties to their initial and inherit value. See examples.

The all property resets all the properties of the selected element apart from unicode-bidi and direction, which control text direction.

This property is considered a reset shorthand. Unlike multi-value shorthands like margin or background, it does not have a longhand version or sub-properties.

Initial Valuenormal
Applies toAll elements.
InheritedNo.
AnimatableNo.
VersionCSS3
DOM Syntaxobject.style.all = "inherit";

Syntax

Syntax of CSS all Property

all: initial | inherit | unset | revert | revert-layer;

Example of the all property with revert value:

Example of CSS all Property with revert value

<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
    <style>
      .example {
        background-color: #8ebf42;
        color: #666;
        all: revert;
      }
    </style>
  </head>
  <body>
    <h2>All property example</h2>
    <p>Here the all: revert; is set.</p>
    <div class="example"> An extrovert is a friendly person who enjoys talking to and being with other people. Extroverts love parties, talking on the phone, and meeting new people. </div>
  </body>
</html>

Result

CSS all Property

Example of the all property with inherit, initial, and unset values:

Example of CSS all Property with inherit, initial, and unset values

<!DOCTYPE html>
<html>
  <head>
    <title>Title of the document</title>
    <style>
      body {
        font-size: 15px;
        color: #1c87c9;
      }
      .example1 {
        background-color: #8ebf42;
        color: #666;
      }
      .example2 {
        background-color: #8ebf42;
        color: #666;
        all: inherit;
      }
      .example3 {
        background-color: #8ebf42;
        color: #666;
        all: initial;
      }
      .example4 {
        background-color: #8ebf42;
        color: #666;
        all: unset;
      }
    </style>
  </head>
  <body>
    <h2>All property example</h2>
    <hr />
    <p>No all property:</p>
    <div class="example1"> An extrovert is a friendly person who enjoys talking to and being with other people. Extroverts love parties, talking on the phone, and meeting new people. </div>
    <hr />
    <p>all: inherit:</p>
    <div class="example2"> An extrovert is a friendly person who enjoys talking to and being with other people. Extroverts love parties, talking on the phone, and meeting new people. </div>
    <hr />
    <p>all: initial:</p>
    <div class="example3"> An extrovert is a friendly person who enjoys talking to and being with other people. Extroverts love parties, talking on the phone, and meeting new people. </div>
    <hr />
    <p>all: unset:</p>
    <div class="example4"> An extrovert is a friendly person who enjoys talking to and being with other people. Extroverts love parties, talking on the phone, and meeting new people. </div>
    <hr /> 
  </body>
</html>

Values

ValueDescription
initialSets the property to its initial value.
inheritInherits the property from its parent element.
unsetActs as inherit for inheritable properties and initial for non-inheritable ones.
revertSpecifies behavior that depends on the stylesheet origin to which the declaration belongs.
revert-layerReverts the property to the value set in the previous cascade layer.

Practice

Practice

According to the site w3docs, which of the following statements about CSS are true?