Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

我們的志工尚未將此文章翻譯為 正體中文 (繁體) 版本。加入我們,幫忙翻譯!

Summary

The CSS all shorthand property resets all properties, apart from unicode-bidi and direction, to their initial or inherited value.

Initial valueThere is no practical initial value for it.
Applies toall elements
Inheritedno
MediaThere is no practical media for it.
Computed valueas the specified value applies to each property this is a shorthand for.
Animatableas each of the properties of the shorthand (all properties but unicode-bidi and direction)
Canonical orderthe unique non-ambiguous order defined by the formal grammar

Syntax

all: initial;
all: inherit;
all: unset;

/* CSS Cascading and Inheritance Level 4 */
all: revert;

Values

initial
This keyword indicates to change all the properties applying to the element or the element's parent to their initial value. unicode-bidi and direction values are not affected.
inherit
This keyword indicates to change all the properties applying to the element or the element's parent to their parent value. unicode-bidi and direction values are not affected.
unset
This keyword indicates to change all the properties applying to the element or the element's parent to their parent value if they are inheritable or to their initial value if not. unicode-bidi and direction values are not affected.
revert
If the cascaded value of a property is the revert keyword, the behavior depends on the 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 value is calculated as if no author-level or user-level rules were specified for this property.
author origin
Rolls back the cascade to the user level, so that the specified value is calculated as if no author-level rules were specified for this property. For the purpose of revert, this origin includes the Override and Animation origins.

Formal syntax

initial | inherit | unset

Examples

HTML

<blockquote id="quote">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</blockquote> Phasellus eget velit sagittis.

CSS

html {
  font-size: small;
  background-color: #F0F0F0;
  color: blue;
}

blockquote {
  background-color: skyblue;
  color: red;
}

Results in:

No all property

The <blockquote> uses the browsers 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

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

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

The <blockquote> doesn't use the browser default styling: it is a block element now (inherited value from its containing <div>), its background-color is transparent (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 4
The definition of 'all' in that specification.
Working Draft Added the revert value.
CSS Cascading and Inheritance Level 3
The definition of 'all' in that specification.
Candidate Recommendation Initial definition.

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support 37  27 (27) No support 24 No support
revert No support No support No support No support 9.1
Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support No support 27.0 (27) No support No support No support
revert No support No support No support No support 9.3

See also

The CSS-wide property values: initial, inherit, unset, and revert.

文件標籤與貢獻者

 最近更新: rto,