为了占用更少带宽,代码缩写
1.盒模型代码缩写
略
2.颜色缩写
当设置的颜色是16进制的色彩值时,如果每两位的值相同,可以缩写一半。如:
eg1:p{color:#000000;}
等同于p{color: #000;}
eg2:p{color: #336699;}等同于
p{color: #369;}`
3.字体缩写
body{
font-style:italic;
font-variant:small-caps;
font-weight:bold;
font-size:12px;
line-height:1.5em;
font-family:"宋体",sans-serif;
}
等同于
body{
font:italic small-caps bold 12px/1.5em "宋体",sans-serif;
}
注:
(1)使用这一简写方式至少要指定 font-size 和 font-family 属性,其他的属性(如 font-weight、font-style、font-varient、line-height)如未指定将自动使用默认值。
(2)在缩写时 font-size 与 line-height 中间要加入“/”斜扛。
(3)常用:body{font:12px/1.5em "宋体",sans-serif;}
只是有字号、行间距、中文字体、英文字体设置。