CSS文本
color文字颜色
color: pink;
text-align对齐
text-align: left(right, center);
div默认宽度=100%,文本可以对齐
span默认宽度=文本的宽度
文本已经定在其边框上了,对齐是看不出来效果的。
text-decoration文本修饰
text-decoration: overline;上划线
text-decoration: line-through;删除效果
text-decoration: underline;下划线
text-decoration: blink;大部分浏览器已经取消闪烁效果
text-decoration: none;可以去掉超链的下划线
line-height行间距
数字或者百分比
默认行间距
默认行间距
200%行间距
200%行间距
letter-spacing字符间距
数字
word-spacing单词间距
数字
默认:abcdefg abcdefg abcdefg
效果:a b c d e f g a b c d e f g
text-indent首行缩进
数字
默认:abcdefg abcdefg abcdefg
效果:abcdefg abcdefg
text-transform大小写
text-transform: uppercase;
text-transform: capitalize;
text-transform: lowercase;
空白格white-space
white-space: normal;
- 你管我嘞!不管你怎么要空格或者回车,我只给你一个空格!(多个空白格或者换行符会被合并成一个空白格)
white-space: pre;
- pre诚不欺我!不顾爸爸的约束也给你办!(有多少空白格,显示多少空白格,相当于pre标签,如果长度超出父容器也不会换行)
white-space: pre-wrap;
- pre-wrap(有多少空白格,显示多少空白格,相当于pre标签,如果长度超出父容器,会换行)
white-space: nowrap;
- 没有包裹!不顾爸爸的约束,我能一马平川,直到遇见br才从头来。(一直不换行,直到使用br)
浙公网安备 33010602011771号