在线文档教程

初始值 | initial

initial

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

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

示例

HTML

<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

p { color: red; } em { color: initial; }

规范

SpecificationStatusComment
CSS Cascading and Inheritance Level 4The definition of 'initial' in that specification.Working DraftNo changes from Level 3.
CSS Cascading and Inheritance Level 3The definition of 'initial' in that specification.Candidate RecommendationDefines what an initial value is.
CSS Values and Units Module Level 3The definition of 'initial' in that specification.Candidate RecommendationDefines the keyword.

浏览器兼容性

FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari (WebKit)
Basic support1.03.5 (1.9.1)-moz1 19.0 (19.0)No support15.01.2

FeatureAndroidFirefox Mobile (Gecko)IE PhoneOpera MobileSafari Mobile
Basic support1.01.0 (1.9.1)-moz1 19.0 (19.0)No supportNo support(Yes)