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

初始值 | initial

initial?是将属性的初始值(?initial value)赋给元素?. initial 适用于所有的css 属性(属性的initial值可在属性表中查到),包括css 简写属性(全局属性)all.

在继承的属性上,初始值可能会令人惊讶。你应该考虑使用inheritunsetrevert关键字来代替。

示例

HTML

代码语言:javascript
复制
<p>
  <span>This text is red.</span>
  <em>This text is in the initial color (e.g., black).</em>
  <span>This is red again.</span>
</p>

CSS

代码语言:javascript
复制
p {
  color: red;
}

em {
  color: initial;
}

规范

Specification

Status

Comment

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

Working Draft

No changes from Level 3.

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

Candidate Recommendation

Defines what an initial value is.

CSS Values and Units Module Level 3The definition of 'initial' in that specification.

Candidate Recommendation

Defines the keyword.

浏览器兼容性

Feature

Chrome

Firefox (Gecko)

Internet Explorer

Opera

Safari (WebKit)

Basic support

1.0

3.5 (1.9.1)-moz1 19.0 (19.0)

No support

15.0

1.2

Feature

Android

Firefox Mobile (Gecko)

IE Phone

Opera Mobile

Safari Mobile

Basic support

1.0

1.0 (1.9.1)-moz1 19.0 (19.0)

No support

No support

(Yes)

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com