1、color
语法:
h1 {
color: red;
color: #ff0000;
color: rgb(255,0,0);
}
作用:前景色,设置文本的颜色
2、text-align
语法:
h1 {
text-align: left/right/center;
}
作用:设置文本的对齐方式,左对齐/右对齐/居中对齐
3、text-decoration
语法:
h1 {
text-decoration: none/underline/line-through/aboveline
}
作用:添加到文本的修饰,无/下划线/删除线/上划线
4、text-indent
语法:
p {
text-indent: 20px
text-indent: 2em
//em: 相对于当前段落字体大小的单位,1em就是一个字的距离,2em就是两个字的距离
}
作用:指定文本的第一行的缩进,通常是将段落的首行缩进
5、line-height
语法:
p {
line-height: 20px
//行间距 = 上间距+文本高度+下间距(上下间距等分)
}
作用:设置行间的距离(行高),可以控制文字行与行之间的距离
CSS文本样式属性介绍
该博客介绍了CSS中几个文本样式属性。包括color用于设置文本颜色,text-align设置文本对齐方式,text-decoration添加文本修饰,text-indent指定文本首行缩进,line-height设置行高,控制文字行间距。
1244

被折叠的 条评论
为什么被折叠?



