日期:2014-05-17  浏览次数:20712 次

CSS----font属性的缩写技巧
font : font -style || font -variant || font -weight || font -size || line-height || font -family
?
详细说明如下:
font属性是用来控制文字字体、颜色、大小等。而font的属性有多种,在通常情况下,
我们用缩写的办法将多种属性概括在一句css代码中。这样极大的减小了代码,优化css文件。


我们常用的font属性有下面这六种:
font-style设定斜体 如:font-style: italic;
font-weight设定文字粗细 如:font-weight: bold;
font-size设定文字大小 如:font-size: 12px;
line-height设定行距 如:line-height: 150%;
color设定文字颜色(注意不是font-color) 如:color: red;
font-family设定字体 如:font-family : "Lucida Grande", Verdana, Lucida, Arial, Helvetica, 宋体,sans-serif;
上述的属性,我们可以概括写在一行font属性里。
{font: italic bold 12px/150% "Lucida Grande", Verdana, Lucida, Arial, Helvetica, 宋体,sans-serif;}