initial
CSS 关键词应用
初始 (或默认) 值
of a property to an element. It can be applied to any CSS property.
This includes the CSS shorthand
all
, with which
initial
can be used to restore all CSS properties to their initial state.
On
inherited properties
, the initial value may be unexpected. You should consider using the
继承
,
unset
,或
revert
关键词代替。
<p> <span>This text is red.</span> <em>This text is in the initial color (typically black).</em> <span>This is red again.</span> </p>
p {
color: red;
}
em {
color: initial;
}
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
initial
|
Chrome 完整支持 1 | Edge 完整支持 13 |
Firefox
完整支持
19
|
IE 不支持 No | Opera 完整支持 15 | Safari 完整支持 1.2 | WebView Android 完整支持 1 | Chrome Android 完整支持 18 |
Firefox Android
完整支持
19
|
Opera Android 完整支持 14 | Safari iOS 完整支持 1 | Samsung Internet Android 完整支持 1.0 |
完整支持
不支持
要求使用供应商前缀或不同名称。
unset
to set a property to its inherited value if it inherits, or to its initial value if not.
revert
to reset a property to the value established by the user-agent stylesheet (or by user styles, if any exist).
继承
to make an element's property the same as its parent.
all
property lets you reset all properties to their initial, inherited, reverted, or unset state at once.