我使用了字体,但声明中似乎遗漏了一些内容。我应该如何声明才能使我的字体正常工作?我的工作文件夹中有该字体。
@font-face {
font-family: 'HThin';
src: url("/assets/fontsfontsHelveticaNeue-Thin.otf") format("opentype");}
.header-text{
font-family:'HThin';
color: white;
width: 50%;
height: 50%;
margin: auto;
position: absolute;
top: 0; left: 0; bottom: 0; right: 0; }
最佳答案
你确定字体的路径是正确的吗? 如果字体所在的目录与 .css 文件位于同一位置,则应写入“../assets/fontsfontsHelveticaNeue-Thin.otf”。 顺便说一句,请记住@font-face 的供应商前缀 http://shouldiprefix.com/#font-face
关于html - 错误的路径字体不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35862634/