模型
盒模型中margin,padding,border都是按照顺时针排列(上,右,下,左)
颜色值缩写,在十六进制中只要两个数字相同,就可以缩写,
字体缩写:
1 body{ 2 font-style:italic;//斜体 3 font-variant:small-caps; 4 font-weight:bold; 5 font-size:12px; 6 line-height:1.6em; //行高 7 font-family:"宋体",sans-serif;//宋体,无衬线字体 8 }
可以缩写为
1 body{ 2 font:italic small-caps bold 12px/1.5em "宋体",sans-serif; 3 }
1、使用这一简写方式你至少要指定 font-size 和 font-family 属性,其他的属性(如 font-weight、font-style、font-varient、line-height)如未指定将自动使用默认值。
2、在缩写时 font-size 与 line-height 中间要加入“/”斜扛。
常用简写方式
1 body{ 2 font:12px/1.5em "宋体",sans-serif; 3 }
颜色的选择
1RGB(red,green,blue)选择p{color:RGB(133,125,150);}
2十六进制(#00ffcc),别忘了#号(这么多颜色不用记着,可以在ps中用取色器)
3英文命令颜色p{color:red;}
长度值
1像素,相对值:像素指的是显示器上的小点(CSS规范中假设“90像素=1英寸”)
2百分比:相对值p{font-size:12px;line-height:130%}
3 em:相对值。但当给 font-size 设置单位为 em 时,此时计算的标准以 p 的父元素的 font-size 为基础。
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>长度</title> 6 <style type="text/css"> 7 p{font-size:14px;text-indent:2em;}//注意font-size,text-indent以分号分隔 8 span{font-size:0.8em;} 9 </style> 10 </head> 11 <body> 12 <p>慕课网,<span>超酷的互联网</span>、IT技术免费学习平台,创新的网络一站式学习、实践体验;<span>服务及时贴心</span>,内容专业、<span>有趣易学</span>。专注服务互联网工程师快速成为技术高手!</p> 13 </body> 14 </html>