指定字体名称
```css
body {
font-family: Arial, sans-serif;
}
使用`font`属性
```cssp.one {
font: 15px arial, sans-serif;
}
p.two {
font: italic bold 12px/30px Georgia, serif;
}
使用`@font-face`规则
```css
@font-face {
font-family: 'MyFont';
src: url('path/to/myfont.woff2') format('woff2');
}
body {
font-family: 'MyFont', sans-serif;
}
使用`font-variation-settings`属性 (针对支持的可变字体):
```css
p {
font-family: 'RobotoVF', sans-serif;
font-variation-settings: 'wght' 400, 'wdth' 100;
}
设置字体样式(使用简写属性):

```css
p {
font: italic bold 12px/30px Georgia, serif;
}
设置字体大小```css
p {
font-size: 16px;
}
设置字体粗细
```css
p {
font-weight: bold;
}
设置字体风格
```cssp {
font-style: italic;
}
设置字体族
```css
p {
font-family: serif;
}
设置行高
(与`font`属性一起使用):
```css
p {
font: 16px Arial, sans-serif;
line-height: 1.5;
}
请根据您的需求选择合适的方法来设置字体样式。
