文本
字体:
font-family: serif;
参数说明:多个字体名称用 "," 分割
常用字体:
[衬体]
serif
SimSun 宋体(windows xp默认字体、macOS支持)
[无衬体]
sans-serif
Arial
Tahoma
Microsoft YaHei 微软雅黑(Windows系统默认、macOS大部份支持)
字体大小:
font-size: 14px;
字体的粗细:
font-weight: 400;
参数说明:(细)100 - 900(粗)
文字颜色:
color: #000;
文本对齐方式:
text-align: center;
参数说明:
left 默认、左边排列
right 右边排列
center 中间排列
inherit 从父标签继承
文本修饰:
text-decoration: none;
参数说明:
none 默认、无修饰(可去除a标签下划线)
underline 下划线
overline 上划线
line-through 删除线
blink 闪烁文本
inherit 从父标签继承
文本缩进:
text-indent: 14px;
行间距:
line-height: 30px;
参数说明:可使用 "%"
字符间距:
letter-spacing: 1px;
参数说明:允许使用负值 "-1px"
注:纯字母时,每个字母都会产生间距
字间距:
word-spacing: 1px;
参数说明:允许使用负值 "-1px"
注:纯字母时,空白处产生间距
空白字符处理方式:
white-space: pre;
参数说明:
normal 默认、忽略空白字符
pre 保留空白、类似<pre>标签
nowrap 文本不换行,换行使用<br/> 标签
pre-wrap 保留空白符,正常换行
pre-line 合并空白符,保留换行符
inherit 从父标签继承
注:
文本换行兼容处理:父标签添加
word-wrap:break-word;
overflow:hidden;