Skip to content
On this page

定义字体

css
font-family: "微软雅黑", sans-serif;  /* 字体名称,可设多个作为回退 */

自定义字体使用 @font-face

css
@font-face {
  font-family: "MyFont";
  src: url("myfont.woff2") format("woff2");
}

字体样式

css
font-style: italic;  /* 斜体 */
font-style: normal;  /* 正常(取消斜体) */

字体装饰

css
text-decoration: underline;       /* 下划线 */
text-decoration: line-through;    /* 删除线 */
text-decoration: overline;        /* 上划线 */
text-decoration: none;            /* 去掉所有装饰 */
text-decoration: underline overline;                    /* 下划线 + 上划线 */
text-decoration: underline overline line-through;       /* 三者叠加 */

字体大小

css
font-size: 30px;  /* 字体大小 */

字体粗细

css
font-weight: 700;    /* 加粗(数值 100–900) */
font-weight: bold;   /* 加粗(关键字,等价 700) */
font-weight: normal; /* 正常(等价 400) */