initial
>CSS 关键字 initial 将属性的初始(或默认)值应用于元素。不应将初始值与浏览器样式表指定的值混淆。它可以应用于任何 CSS 属性。这包括 CSS 简写 all,initial 可用于将所有 CSS 属性恢复到其初始状态。
示例
HTML
html
<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>
CSS
css
p {
color: red;
}
em {
color: initial;
}
Specifications
| 规范 |
|---|
| CSS Cascading and Inheritance Level 4> # initial> |
浏览器兼容性
参见
- Use
unsetto set a property to its inherited value if it inherits, or to its initial value if not. - Use
revertto reset a property to the value established by the user-agent stylesheet (or by user styles, if any exist). - Use
inheritto make an element's property the same as its parent. - The
allproperty lets you reset all properties to their initial, inherited, reverted, or unset state at once.