所以我想在HTML中插入一个自定义字体,但我想不通。我试着在下面做这个代码,但没有成功。
这是我尝试使用的字体的文件https://drive.google.com/drive/folders/1C_2kPmCHj60KyFKcxYiGuOkRO8p820Yt?usp=sharing
代码
<head>
<div class = "center">
<h1 style = "font-face: myFirstFont">
Hi
</h1>
</div>
<style>
div.center {
text-align: center;
}
@font-face {
font-family: myFirstFont;
src: url(candyshopregular-nobo-webfont.woff2);
}
</style>
</head>
</html>
将HTML的第3行更改为:
<h1 style="font-face: myFirstFont">
至:
<h1 style="font-family: myFirstFont">