如何添加自定义字体?
1. 在 head html 自定义文本框中添加如下代码, 正确指定自定义字体的路径。
<style>
@font-face {
font-family: Rubik;
font-weight: 500;
font-style: normal;
font-display: swap;
src: url("xx/Rubik_n5.woff2") format("woff2"),
url("xxx/rubik_n5.woff2") format("woff");
}
@font-face {
font-family: Rubik;
font-weight: 400;
font-style: normal;
font-display: swap;
src: url("xxx/rubik_n4.woff2") format("woff2"),
url("xxx/rubik_n4.woff2") format("woff");
}
.font-custom {
font-family: Rubik;
}
</style>
2. 在<body>标签中添加自定义字体样式
<body class="font-custom ...">