【发布时间】:2020-03-04 15:49:39
【问题描述】:
我一直在尝试使用 css 和自定义字体,但在完全相同的情况下遇到了问题;我可以让其他字体正常工作,但不是我想要使用的字体。我是否需要包含一些我不知道的异常处理?
这会起作用
@font-face{
src: url("VeganStylePersonalUse-5Y58.ttf");
font-family: "custom";
}
.h1{
font-family: "custom"
}
但这不会
@font-face{
src: url("runescape_uf.ttf");
font-family: "custom";
}
.h1{
font-family: "custom"
}
它们都与 html 和 css 位于同一文件夹中,可以在
https://www.fontspace.com/billy-argel/vegan-style-personal-use
找到
&
https://fontmeme.com/fonts/runescape-uf-font/
【问题讨论】:
-
你检查过你的src URL目录路径是否正确吗?
-
是的,我检查了三次,甚至尝试了 windows/fonts 路径,但这似乎根本不起作用
-
@S Benfield 在末尾添加
format("ttf")例如:src: url("runescape_uf.ttf") format("ttf"); -
这不起作用,它使其他字体起作用,而不起作用。
-
@S Banfield
@font-face { font-family: 'Vegan Style Personal Use Regular'; font-style: normal; font-weight: normal; src: local('Vegan Style Personal Use Regular'), url('Vegan Style Personal Use.woff') format('woff'); }