CSS 文本实例

1、设置文本的颜色

color:red;
color:#00ff00
color:rgb(0,0,255)

2、增加或减少字符间距

letter-spacing:-0.5em
letter-spacing:20px

3、使用百分比值来设置段落中的行间距。

line-height:90%
line-height: 30px
line-height: 2

4、对齐文本

text-align: center

5、向文本添加修饰

text-decoration:overline;
text-decoration:line-through;
text-decoration:underline;
text-decoration:blink;
text-decoration:none

 6、缩进文本首行

注意:一般来说,可以为所有块级元素应用 text-indent,但无法将该属性应用于行内元素,图像之类的替换元素上也无法应用 text-indent 属性。不过,如果一个块级元素(比如段落)的首行中有一个图像,它会随该行的其余文本移动。

提示:如果想把一个行内元素的第一行“缩进”,可以用左内边距或外边距创造这种效果。

text-indent: 1cm

7、控制文本中的字母

text-transform:uppercase
text-transform:lowercase
text-transform:capitalize

8、禁止在元素中的文本折行,控制不换行

white-space: nowrap

9、增加段落中单词间的距离

word-spacing: 30px;
原文地址:https://www.cnblogs.com/Nyan-Workflow-FC/p/6597108.html