CSS参考手册
级联和继承 | Cascading & Inheritance
初始值 | initial
initial
是将属性的初始值( initial value)赋给元素 . initial 适用于所有的css 属性(属性的initial值可在属性表中查到),包括css 简写属性(全局属性)all
.
在继承的属性上,初始值可能会令人惊讶。你应该考虑使用inherit
,unset
或revert
关键字来代替。
示例
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;
}
规范
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) |
级联和继承 | Cascading & Inheritance相关
层叠样式表( Cascading Style Sheets )是一种用来表现 HTML 或 XML 等文件样式的计算机语言。CSS 不仅可以静态地修饰网页,还可以配合各种脚本语言动态地对网页各元素进行格式化。