all 简写 CSS property resets all of an element's properties except unicode-bidi , direction ,和 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.

句法

/* Global values */
all: initial;
all: inherit;
all: unset;
/* CSS Cascading and Inheritance Level 4 */
all: revert;
					

all property is specified as one of the CSS global keyword values. Note that none of these values affect the unicode-bidi and direction 特性。

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
相当于 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.

形式定义

初始值 There is no practical initial value for it.
适用于 所有元素
继承 no
计算值 as the specified value applies to each property this is a shorthand for.
动画类型 as each of the properties of the shorthand (all properties but unicode-bidi and direction )

形式句法

initial | inherit | unset | revert
								

范例

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;
}
								

结果

No all property

<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> 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> 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> 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).

规范

规范 状态 注释
CSS Cascading and Inheritance Level 4
The definition of 'all' in that specification.
候选推荐 添加 revert 值。
CSS Cascading and Inheritance Level 3
The definition of 'all' in that specification.
候选推荐 初始定义。

浏览器兼容性

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. 更新 GitHub 上的兼容性数据
Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
all Chrome 完整支持 37 Edge 完整支持 79 Firefox 完整支持 27 IE 不支持 No Opera 完整支持 24 Safari 完整支持 9.1 WebView Android 完整支持 37 Chrome Android 完整支持 37 Firefox Android 完整支持 27 Opera Android 完整支持 24 Safari iOS 完整支持 9.3 Samsung Internet Android 完整支持 3.0
revert Chrome 完整支持 84 Edge 完整支持 84 Firefox 完整支持 67 IE 不支持 No Opera 完整支持 70 Safari 完整支持 9.1 WebView Android 完整支持 84 Chrome Android 完整支持 84 Firefox Android 完整支持 67 Opera Android 不支持 No Safari iOS 完整支持 9.3 Samsung Internet Android 不支持 No

图例

完整支持

完整支持

不支持

不支持

另请参阅

CSS global keyword values: initial , inherit , unset , revert

元数据

  • 最后修改:
  1. CSS
  2. CSS 参考
  3. CSS Miscellaneous
  4. 特性
    1. all
    2. text-rendering

Copyright  © 2014-2026 乐数软件    

工业和信息化部: 粤ICP备14079481号-1