css中的字体样式设置分别是什么意思
时间: 2023-07-31 10:05:27 浏览: 54
在 CSS 中,设置字体样式有以下几个属性:
1. `font-family`:设置字体族名称,可以是一个或多个字体名称,浏览器会按照顺序依次寻找可用的字体。常见字体包括 Arial、Times New Roman、Verdana 等。
2. `font-size`:设置字体大小,可以是像素值、百分比、em 等,常用单位是像素(px)。
3. `font-weight`:设置字体粗细,可取值为 normal、bold、bolder、lighter 或数值(400 等)。
4. `font-style`:设置字体风格,可取值为 normal、italic、oblique。
5. `text-decoration`:设置文本修饰线,可取值为 none、underline、overline、line-through。
6. `text-transform`:设置文本转换效果,可取值为 none、uppercase、lowercase、capitalize。
7. `font-variant`:设置小型大写字母的字体显示,可取值为 normal、small-caps。
以上属性可以组合使用,例如:
```
font: 16px Arial, sans-serif;
font-weight: bold;
font-style: italic;
text-decoration: underline;
text-transform: uppercase;
```
这段代码将设置字体大小为 16 像素,字体为 Arial 或 sans-serif,字体加粗,字体风格为斜体,文本带下划线,文本转换为大写。