initial
åºçº¿
广æ³å¯ç¨
èª 2015å¹´11æ èµ·ï¼æ¤ç¹æ§å·²å¨ä¸»æµæµè§å¨ä¸å¾å°æ¯æï¼å¯å¨å¤§å¤æ°è®¾å¤åæµè§å¨çæ¬ä¸æ£å¸¸ä½¿ç¨ã
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.