Skip to content

将自定义字体作为 css 文件引入

示例如下:

css
/* light */
@font-face {
  font-family: "LxgwWenKai";
  src: url("./fonts/LXGWWenKai-Light.ttf") format("truetype");
  font-weight: 300;
  font-style: normal;
}

/* regular */
@font-face {
  font-family: "LxgwWenKai";
  src: url("./fonts/LXGWWenKai-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
}

/* medium */
@font-face {
  font-family: "LxgwWenKai";
  src: url("./fonts/LXGWWenKai-Medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
}

/* semibold */
@font-face {
  font-family: "LxgwWenKai";
  src: url("./fonts/LXGWWenKai-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
}

/* bold */
@font-face {
  font-family: "LxgwWenKai";
  src: url("./fonts/LXGWWenKai-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
}
css
body {
  font-family: "LxgwWenKai", sans-serif; /* 使用自定义字体 */
}
2025( )
今日 8.33%
本周 42.86%
本月 48.39%
本年 4.11%
Powered by Snowinlu | Copyright © 2024- | MIT License