1.文本相关属性
个数 | 属性 | 描述 | 说明 |
1 | font-size | 字体大小 | 单位可以是px,pt,em等 12pt=16px 1em=16px 浏览器默认是16px,设计图常用字号是12px |
2 | color | 颜色 | color:red; color:#ff0; color:rgb(255,0,0); 0-255 |
3 | font-family | 字体 | 当字体是中文字体、英文字体中有空格时,需加双引号; 多个字体中间用逗号链接,先解析第1个字体,如果没有解析第2个字体,以此类推,浏览器默认的是微软雅黑字体 |
4 | font-weight | 加粗 | font-weight:bolder(更粗的)/bold(加粗)/normal(常规) font-weight:100-900; 100-500不加粗 600-900加粗 |
5 | font-style | 倾斜 | font-style:italic(斜体字)/oblique(倾斜的文字)/normal(常规显示); |
个数 | 属性 | 描述 | 说明 |
6 | text-align | 文本水平对齐 | text-align:left; 水平靠左 text-align:right;水平靠右 text-align:center;水平居中 text-align:justify;水平2端对齐,但是只对多行起作用。 |
个数 | 属性 | 描述 | 说明 |
7 | line-height | 行高 | line-height的数据=height的数据,可以实现单行文本垂直居中 |
8 | font | 文字简写 | font是font-style font-weight font-size / line-height font-family 的简写。 font:italic 800 30px/80px "宋体";顺序不能改变 ,必须同时指定font-size和font-family属性时才起作用 |
9 | text-decoration | 文本修饰 | text-decoration:none没有/underline下划线/overline上划线/line-through删除线 |
10 | text-indent | 首行缩进 | text-indent可以取负值; text-indent属性只对第一行起作用 |
11 | letter-spacing | 字间距 | 控制文字和文字之间的间距 |
2.列表相关属性
个数 | 属性 | 描述 | 说明 |
1 | list-style-type | 定义列表符合样式 | list-style-type:disc(实心圆)/circle(空心圆)/square(实心方块)/none(去掉符号) |
2 | list-style-image | 将图片设置为列表符合样式 | list-style-image:url(); |
3 | list-style-position | 设置列表项标记的放置位置。 | list-style-position:outside;列表的外面 默认值 list-style-position:inside;列表的里面 |
4 | list-style | 简写 | list-style:none; 去除列表符号 |
3.背景相关属性
个数 | 属性 | 描述 | 说明 |
1 | background-color | 背景颜色 | background-color:red; |
2 | background-image | 背景图片 | background-image:url(); |
3 | background-repeat | 背景图片的平铺 | background-repeat:no-repeat/repeat/repeat-x/repeat-y; |
4 | background-position | 背景图片的定位 | background-position:水平位置 垂直位置;可以给负值 |
5 | background-attachment | 背景图片的固定 | background-attachment : scroll (滚动)/ fixed(固定,固定在浏览器窗口里面,固定之后就相对于浏览器窗口了) ; |
可以简写成background