浮动
标准文档流:元素默认的排列方式从上往下,从左往右
float:left/right/none
清除浮动:
1.空标签清除浮动
<div style="clear:both"></div>
clear:left/right/none;
2.给父元素加height(最好不要用)
padding-top:上内边距 padding-bottom:下内边距 padding-left:左内边距 padding-right:右内边距
margin-top:上外边距 margin-bottom:下外边距 margin-left:左外边距 margin-right:右外边距
list-style:none 列表项前无标记
CSS文本属性
font-style:italic(斜体字)/oblique(倾斜,幅度要大一些,一般不太明显)/normal(常规显示);
font-weight:bolder(更粗的)/bold(加粗)/normal(常规)
font-weight:100-900; 100-500不加粗 600-900加粗
font-family:当字体是中文字体、英文字体中有空格时,需加双引号;
多个字体中间用逗号链接,先解析第1个字体,如果没有解析第2个字体,以此类推
font-size:单位可以是px,pt,em等 12pt=16px 1em=16px 浏览器默认是16px,设计图常用字号是12px
text-align:left; 水平靠左
text-align:right;水平靠右
text-align:center;水平居中
text-align:justify;水平2端对齐,但是只对多行起作用。
line-height的数据=height的数据,可以实现单行文本垂直居中
font是font-style font-weight font-size / line-height font-family 的简写。
font:italic 800 30px/80px "宋体";顺序不能改变 ,必须同时指定font-size和font-family属性时才起作用
text-decoration:文本修饰 underline加下划线 overline加上划线line-through删除线 none没有
text-indent:首行缩进 text-indent可以取负值; text-indent属性只对第一行起作用
CSS的列表属性
list-style -type(:disc(实心圆)/circle(空心圆)/square(实心方块)/none(去掉符号))
list-style-position设置列表项标记的放置位置
list-style-position:outside;列表的外面 默认值
list-style-position:inside;列表的里面
list-style-image将图片设置为列表符合样式 list-style-image:url();(对图片大小有限制,一般不用)
list-style:none; 去除列表符号(三个list-style属性复合而成,用它最多)
CSS的背景属性
background-color背景颜色
background-image背景图片 background-image:url();(默认平铺(重复)div)
background-repeat背景图片的平铺 background-repeat:no-repeat/repeat/repeat-x/repeat-y;
background-position背景图片的定位 水平位置 垂直位置;可以给负值
方位名词:left、right、center、bottom
固定位置:px
background:背景颜色,图片,是否平铺,图片定位;