css Text(文本)属性可定义文本的外观,如文本颜色、对齐文本、装饰文本、文本缩进、行间距等
1.文本颜色
color属性用于定义文本的颜色。
div {
color: red;
}
|---------|----------------|
| 表示方式 | 属性值 |
| 预定义的颜色值 | red,green,blue |
| 十六进制 | #FF000 |
| RGB代码 | rgb(255,0,0) |


2.对齐文本
text-align属性用于设置元素文本内容的水平对齐方式
|--------|------|
| 属性值 | 解释 |
| left | 左对齐 |
| right | 右对齐 |
| center | 居中对齐 |
div {
text-align: center;
}

3.装饰文本
text-decoration属性规定添加到文本的修饰,可以给文本添加下划线、删除线、下划线
div {
text-decoration: underline;
}
|--------------|------------------|
| 属性值 | 描述 |
| none | 默认。没有装饰线 |
| underline | 下划线。链接a自带下划线(常用) |
| overline | 上划线(几乎不用) |
| line-through | 删除线。(不常用) |
3.1删除下划线
我们知道超链接自带下划线,那我们如何删除下划线呢




4.文本缩进
text-indent属性用来指定文本第一行的缩进,通常是将段落的首行缩进
div {
text-indent: 10px;
}
通过设置该属性,所有元素的第一行都可以缩进一个给定的长度,甚至长度可以是负值。


p {
text-indent: 2em;
}
em是一个相对单位,就是当前元素(font-size)1个文字的大小。

5.行间距
line-height属性用于设置行间的距离(行高),可以控制行与行之间的距离。


