The all
shorthand CSS 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 stylesheet origin.
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.
Syntax
/* Global values */ all: initial; all: inherit; all: unset; /* CSS Cascading and Inheritance Level 4 */ all: revert;
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.
Values
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:
- User-agent origin
- Equivalent to
unset
. - User origin
- 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.
- Author origin
- 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 of
revert
, the Author origin includes the Override and Animation origins.
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
initial | inherit | unset | revert
Examples
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;
}
blockquote {
background-color: skyblue;
color: red;
}
Result
No all
property
<blockquote id="quote">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</blockquote> Phasellus eget velit sagittis.
body { font-size: small; background-color: #F0F0F0; color:blue; }
blockquote { background-color: skyblue; color: red; }
The <blockquote>
uses the browser's default styling together with a specific background and text color. It also behaves as a block element: the text that follows it is beneath it.
all:unset
<blockquote id="quote">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</blockquote> Phasellus eget velit sagittis.
body { font-size: small; background-color: #F0F0F0; color:blue; }
blockquote { background-color: skyblue; color: red; }
blockquote { all: unset; }
The <blockquote>
doesn't use the browser default styling: it is an inline element now (initial value), its background-color
is transparent
(initial value), but its font-size
is still small
(inherited value) and its color
is blue
(inherited value).
all:initial
<blockquote id="quote">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</blockquote> Phasellus eget velit sagittis.
body { font-size: small; background-color: #F0F0F0; color:blue; }
blockquote { background-color: skyblue; color: red; }
blockquote { all: initial; }
The <blockquote>
doesn't use the browser default styling: it is an inline element now (initial value), its background-color
is transparent
(initial value), its font-size
is normal
(initial value) and its color
is black
(initial value).
all:inherit
<blockquote id="quote">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</blockquote> Phasellus eget velit sagittis.
body { font-size: small; background-color: #F0F0F0; color:blue; }
blockquote { background-color: skyblue; color: red; }
blockquote { all: inherit; }
The <blockquote>
doesn't use the browser default styling: it is a block element now (inherited value from its containing <body>
element), its background-color
is #F0F0F0
(inherited value), its font-size
is small
(inherited value) and its color
is blue
(inherited value).
Specifications
Specification | Status | Comment |
---|---|---|
CSS Cascading and Inheritance Level 4The definition of 'all' in that specification. | Candidate Recommendation | Added the revert value.
|
CSS Cascading and Inheritance Level 3The definition of 'all' in that specification. | Candidate Recommendation | Initial definition. |
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
all
|
Chrome
Full support 37 |
Edge
Full support 79 |
Firefox
Full support 27 |
IE
No support No |
Opera
Full support 24 |
Safari
Full support 9.1 |
WebView Android
Full support 37 |
Chrome Android
Full support 37 |
Firefox Android
Full support 27 |
Opera Android
Full support 24 |
Safari iOS
Full support 9.3 |
Samsung Internet Android
Full support 3.0 |
revert
|
Chrome
Full support 84 |
Edge
Full support 84 |
Firefox
Full support 67 |
IE
No support No |
Opera
Full support 70 |
Safari
Full support 9.1 |
WebView Android
Full support 84 |
Chrome Android
Full support 84 |
Firefox Android
Full support 67 |
Opera Android
No support No |
Safari iOS
Full support 9.3 |
Samsung Internet Android
No support No |
Legend
- Full support
- Full support
- No support
- No support
See also
CSS global keyword values: initial
, inherit
, unset
, revert
all by Mozilla Contributors is licensed under CC-BY-SA 2.5.