首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

所有 | all

CSSall简写属性重设除了unicode-bididirection之外的所有属性至它们的初始值或继承值。

代码语言:javascript
复制
/* Global values */
all: initial;
all: inherit;
all: unset;

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

初始值

There is no practical initial value for it.

适用元素

all elements

是否是继承属性

no

适用媒体

There is no practical media for it.

计算值

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)

正规顺序

the unique non-ambiguous order defined by the formal grammar

语法

initial该关键字代表改变该元素或其父元素的所有属性至初始值。 unicode-bidi和 direction不受影响。

inherit该关键字代表改变该元素或其父元素的所有属性的值至他们的父元素属性的值。 unicode-bidi和 direction不受影响。

unset该关键字代表如果该元素的属性的值是可继承的,则改变该元素或该元素的父元素的所有属性的值为他们父元素的属性值,反之则改变为初始值。unicode-bidi和 direction不受影响。

正式语法

代码语言:javascript
复制
initial | inherit | unset

示例

HTML

代码语言:javascript
复制
<blockquote id="quote">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</blockquote> Phasellus eget velit sagittis.

CSS

代码语言:javascript
复制
body {
  font-size: small;
  background-color: #F0F0F0;
  color: blue;
}

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

结果如下:

没有all属性

<blockquote>使用浏览器默认样式和定义的背景色和文字颜色。它表现为block元素:它之后的文字位于它的下方。

all:unset

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

all:initial

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

all:inherit

<blockquote> 没有使用浏览器默认样式:它现在是个block元素(继承值),它的background-color是 transparent (继承值),它的font-sizesmall (继承值) ,它的 colorblue (继承值)。

规范

Specification

Status

Comment

CSS Cascading and Inheritance Level 4The definition of 'all' in that specification.

Working Draft

Added the revert value.

CSS Cascading and Inheritance Level 3The definition of 'all' in that specification.

Candidate Recommendation

Initial definition.

浏览器兼容性

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

扫码关注腾讯云开发者

领取腾讯云代金券