1.text系列
1.1text-align: 设置文本对齐方式
- left :左对齐
- right:右对齐
- center:居中对齐
p{ text-align:center; }
1.2 text-indent:设置首行缩进
- 2em; 缩进两个字
p{ text-indent:2em; }
1.3 text-decoration: 设置文本的修饰
- none:没有修饰
- line-through : 删除线
- underline :下划线
- overline : 上划线
p { text-decoration:none; text-decoration:underline; text-decoration:overline; text-decoration:line-through; }
1.4color: 设置文本颜色
p{ color:red; }
2.font系列
2.1font-size : 设置字体尺寸
2.2 font-weight: 设置字体是否加粗
- bold : 加粗
- normal: 正常
2.3 font-style:设置字体是否斜体
- italic: 斜体
- normal : 正常
2.4 line-height: 设置文字的行高
- 数字 : 表示字体的倍数
- 行高指的是文字和前后的空间总共占据的高度,行高越大,行间距越大
- 特殊用法:单行文本垂直居中,把line-height设置为height相同的值
p {
font-weight: bold;
font-style:italic;
font-size: 20px;
line-height: 40px;
line-height: 2; /* -->40px */
}
2.5 font-family:设置字体的族类
p {
font-family: "宋体";
font-family: "Helvetica Neue", "Helvetica,Arial", "Microsoft Yahei", "Hiragino Sans GB", "Heiti SC", "WenQuanYi Micro Hei", "sans-serif";
}
2.6 font : 字体系列属性的简写
- 可设置的属性是(按顺序): "font-style font-variant font-weight font-size/line-height font-family"
- 简写属性值顺序不能随意调整
- 至少包含font-size和font-family两个值
p{
font: italic bold 20px/2 "宋体";
}