## Font
font簡寫也是使用最多的一個,它也是書寫高效的CSS的方法之一。
font包含以下屬性:
1. font-style: normal || italic || oblique;
2. font-variant:normal || small-caps;
3. font-weight: normal || bold || bolder || || lighter || (100-900);
4. font-size: (number+unit) || (xx-small - xx-large);
5. line-height: normal || (number+unit);
6. font-family:name,"more names";
font的各個屬性也都有默認值,記住這些默認值相對來說比較重要:
~~~
font-style: normal;
font-variant: normal;
font-weight: normal;
font-size: inherit;
line-height: normal;
font-family: inherit;
~~~
事實上,font的簡寫是這些簡寫中最需要小心的一個,稍有疏忽就會造成一些意想不到的后果,所以,很多人并不贊成使用font縮寫。
~~~
font-style: italic;
font-variant: small-caps;
font-weight: bold;
font-size: 1em;
line-height: 1.5em;
font-family: verdana, sans-serif;
~~~
font的縮寫格式:
~~~
font: bold italic small-caps 1em/1.5em verdana,sans-serif;
~~~
font(字體):字體、字號、字體樣式、字體粗細、字體變體、線高度、字體大小調整、字體拉伸
**必須注意的是:簡寫方法只有在同時指定font-size和font-family屬性時才起作用。**
如果你沒有設定font-weight, font-style, 以及 font-varient,css會使用缺省值。