简体   繁体   中英

CSS Reset and Font-family

html, body, h1, h2, h3, h4, p, div, ul, ol, li {
padding: 0;
border: 0;
margin: 0;
font: inherit;
font-size: 100%;
font-family: "Helvetica Neue", Helvetica, sans-serif; 
}

Does someone know why the "font-family" property does not work if I move it above "font:inherit"?

Because font is a shorthand that includes font-family .

If you set the same property twice in the same rule-set, then the last one wins.

To illustrate:

 div { display: inline-block; height: 20px; width: 20px; padding: 5px; margin: 5px } .A { border: solid red 1px; border-left: dotted blue 2px; } .B { border-left: dotted blue 2px; border: solid red 1px; } 
 <div class="A"></div> <div class="B"></div> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM