Font样式
-
字体:font-family
font-family:Helvetica, Arial, sans-serif;
-
颜色:color
color:black,red,white;
color:rbg(255,0,0);
color:#ffffff;
-
字体大小:font-size
font-size:10px;
-
字体样式:font-style
名称 | 含义 |
---|---|
normal | 将文本设置为普通字体 |
italic | 如果当前字体的斜体版本可用,那么文本设置为斜体版本;如果不可用,那么会利用 oblique 状态来模拟 italics |
oblique | 将文本设置为斜体字体的模拟版本,也就是将普通文本倾斜的样式应用到文本中 |
- 字体粗细:font-weight
名称 | 样式 |
---|---|
normal | 普通字体 |
bold | 字体加粗 |
lighter | 较普通字体更细 |
bolder | 较加粗字体更粗 |
- Font简写:
许多字体的属性也可以通过 font 的简写方式来设置 . 这些是按照以下顺序来写的:
font-style, font-variant, font-weight, font-stretch, font-size, line-height, and font-family
font: italic normal bold normal 3em/1.5 Helvetica, Arial, sans-serif;
文本布局样式
- 字体转换:text-transform
名称 | 含义 |
---|---|
none | 防止任何转型 |
uppercase | 将所有文本转为大写 |
lowercase | 将所有文本转为小写 |
capitalize | 转换所有单词让其首字母大写 |
full-width | 将所有字形转换成全角,即固定宽度的正方形,类似于等宽字体,允许拉丁字符和亚洲语言字形(如中文,日文,韩文)对齐 |
- 文本装饰:text-decoration
名称 | 含义 |
---|---|
none | 取消已经存在的任何文本装饰 |
underline | 文本下划线 |
overline | 文本上划线 |
line-through | 穿过文本的线 strikethrough over the text |
- 文字阴影:text-shadow
text-shadow:4px 4px 5px red;
属性 | 含义 |
---|---|
第一个 | 阴影与原始文本的水平偏移 |
第二个 | 阴影与原始文本的垂直偏移 |
第三个 | 模糊半径 |
第四个 | 阴影的基础颜色 |
- 文本布局:text-align
名称 | 含义 |
---|---|
left | 文字左对齐 |
right | 文字右对齐 |
center | 文字居中 |
justify | 使文本展开,改变单词之间的差距,使所有文本行的宽度相同 |
-
文本行高:line-height
line-height: 1.5;
-
字母间距:letter-spacing
letter-spacing:2px;
-
单词间距:word-spacing
word-spacing:4px;
其他
更多样式化文字的属性可查看网页