1、设置字体 body{font-family:"Microsoft Yahei";}兼容性较好或body{font-family:"微软雅黑";}
字体大小和颜色body{font-size:12px;color:#666} font-weight:bold粗体 font-style:italic斜体 text-decoration:underline下划线 text-decoration:line-through删除线
2、段落排版
p{text-indent:2em}段落空两字 p{line-height:1.5em}行间距,行高 letter-spacing:50px;文字间隔或者字母间隔 word-spacing英文单词之间的间距
text-align:center 排版
3、盒子模型
div{ border:2px solid red; }
上面是 border 代码的缩写形式,可以分开写:
div{ border-width:2px; border-style:solid; border-color:red; }
注意:
1、border-style(边框样式)常见样式有:
dashed(虚线)| dotted(点线)| solid(实线)。
2、border-color(边框颜色)中的颜色可设置为十六进制颜色,如:
border-color:#888;//前面的井号不要忘掉。
3、border-width(边框宽度)中的宽度也可以设置为:
thin | medium | thick(但不是很常用),最常还是用象素(px)。
4、css布局模型CSS包含3种基本的布局模型,用英文概括为:Flow、Layer 和 Float。
在网页中,元素有三种布局模型:
1、流动模型(Flow)
2、浮动模型 (Float)
3、层模型(Layer)
5\层模型
1、绝对定位(position: absolute)
2、相对定位(position: relative)
3、固定定位(position: fixed)