这篇翻译不完整。请帮忙从英语翻译这篇文章

CSS all 简写属性 将除却 unicode-bididirection 之外的所有属性重设至其初始值,或继承值。

语法

/* Global values */
all: initial
all: inherit
all: unset

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

all 属性is specified as one of the CSS 全局 keyword values. Note that none of these values affect the unicode-bididirection 这两个属性。

取值

initial
该关键字代表改变该元素或其父元素的所有属性至初始值。
inherit
该关键字代表改变该元素或其父元素的所有属性的值至他们的父元素属性的值。inherited values
unset
该关键字代表如果该元素的属性的值是可继承的,则改变该元素或该元素的父元素的所有属性的值为他们父元素的属性值,反之则改变为初始值。
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.

正式语法

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

结果

没有 all 属性

<blockquote> 使用浏览器默认样式,以及另外的定义的背景色与文字颜色。它是一个 block 元素:它之后的文字位于它的下方。

all:unset

<blockquote> 没有使用浏览器默认样式:它现在是一个 inline 元素(初始值),其 background-colortransparent (初始值),但其 font-size 仍为 small (继承值) ,其 colorblue (继承值)。

all:initial

<blockquote> 没有使用浏览器默认样式:它现在是一个 inline 元素(初始值),其 background-colortransparent (初始值),其 font-sizenormal (初始值),其 colorblack(初始值)。

all:inherit

<blockquote> 没有使用浏览器默认样式:它现在是一个 block 元素(继承自其父元素 <body>),其 background-colortransparent (继承值),其 font-sizesmall (继承值) ,其 colorblue (继承值)。

规范

规范 状态 备注
CSS Cascading and Inheritance Level 4
all
Candidate Recommendation 添加属性值 revert
CSS Cascading and Inheritance Level 3
all
Candidate Recommendation 初始定义。

初始值There is no practical initial value for it.
适用元素all elements
是否是继承属性
适用媒体There is no practical media for it.
计算值as the specified value applies to each property this is a shorthand for.
Animation typeas each of the properties of the shorthand (all properties but unicode-bidi and direction)
正规顺序the unique non-ambiguous order defined by the formal grammar

浏览器兼容性

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support37 ?27 No24 No
revert No ? No No No9.1
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support No ? ?27 No No ?
revert No ? ? No No9.3 No

参见

CSS 通用属性值: initial, inherit and unset.

文档标签和贡献者

标签: 
此页面的贡献者: RainSlide, shuihuo, Sebastianz, fskuok
最后编辑者: RainSlide,