ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
## 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会使用缺省值。