all CSS property
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since January 2020.
The all CSS shorthand property resets all of an element's properties except unicode-bidi, direction, and CSS Custom Properties. It can set properties to their initial or inherited values, or to the values specified in another cascade layer or stylesheet origin.
Try it
/* no all property */
all: initial;
all: inherit;
all: unset;
all: revert;
<section id="default-example">
<div class="example-container-bg">
<div class="example-container">
<p id="example-element">
This paragraph has a font size of 1.5rem and a color of gold. It also
has 1rem of vertical margin set by the user-agent. The parent of the
paragraph is a <div> with a dashed blue border.
</p>
</div>
</div>
</section>
#example-element {
color: gold;
padding: 10px;
font-size: 1.5rem;
text-align: left;
width: 100%;
}
.example-container {
border: 2px dashed #2d5ae1;
}
.example-container-bg {
background-color: #77767b;
padding: 20px;
}
Constituent properties
This property is a shorthand for all CSS properties except for unicode-bidi, direction, and custom properties.
Syntax
/* Global values */
all: initial;
all: inherit;
all: unset;
all: revert;
all: revert-layer;
Values
The all property is specified as one of the CSS global keyword values. Note that none of these values affect the unicode-bidi and direction properties.
initial-
Specifies that all the element's properties should be changed to their initial values.
inherit-
Specifies that all the element's properties should be changed to their inherited values.
unset-
Specifies that all the element's properties should be changed to their inherited values if they inherit by default, or to their initial values if not.
revert-
Specifies behavior that depends on the stylesheet origin to which the declaration belongs:
- If the rule belongs to the author origin, the
revertvalue rolls back the cascade to the user level, so that the specified values are calculated as if no author-level rules were specified for the element. For purposes ofrevert, the author origin includes the Override and Animation origins. - If the rule belongs to the user origin, the
revertvalue rolls back the cascade to the user-agent level, so that the specified values are calculated as if no author-level or user-level rules were specified for the element. - If the rule belongs to the user-agent origin, the
revertvalue acts likeunset.
- If the rule belongs to the author origin, the
revert-layer-
Specifies that all the element's properties should roll back the cascade to a previous cascade layer, if one exists. If no other cascade layer exists, the element's properties will roll back to the matching rule, if one exists, in the current layer or to a previous style origin.
Formal definition
| Initial value | There is no practical initial value for it. |
|---|---|
| Applies to | all elements |
| Inherited | no |
| Computed value | as the specified value applies to each property this is a shorthand for. |
| Animation type | as each of the properties of the shorthand (all properties but unicode-bidi and direction) |
Formal syntax
all =
initial |
inherit |
unset |
revert |
revert-layer |
revert-rule
Examples
In this example, the CSS file contains styling for the <blockquote> element in addition to some styling for the parent <body> element. Various outputs in the Results subsection demonstrate how the styling of the <blockquote> element is affected when different values are applied to the all property inside the blockquote rule.
HTML
<blockquote id="quote">
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
</blockquote>
Phasellus eget velit sagittis.
CSS
body {
font-size: small;
background-color: #f0f0f0;
color: blue;
margin: 0;
padding: 0;
}
blockquote {
background-color: skyblue;
color: red;
}
Results
A. No all property
This is the scenario in which no all property is set inside the blockquote rule. The <blockquote> element uses the browser's default styling which gives it a margin, together with a specific background and text color as specified in the stylesheet. It also behaves as a block element: the text that follows it is beneath it.