[英]Relative URL in @font-face source doesn't work
I downloaded Delicious-Roman font and I want to use it in my CSS page. 我下载了Delicious-Roman字体,并希望在CSS页面中使用它。 It doesn't seem to work with relative URL, but when i placed it in same folder as my CSS page, it worked! 它似乎不适用于相对URL,但是当我将其放在与CSS页面相同的文件夹中时,它起作用了! My folders look like this: 我的文件夹如下所示:
-Project -Fonts -Delicious-Roman.otf -Folder -Project.html -ProjectStyle.css
So I did this: 所以我这样做:
@font-face{
font-family: Delicious;
src: url(../Fonts/Delicious-Roman.otf);
}
div{
font-family: Delicious;
}
But it doesn't work. 但这是行不通的。 When i put Delicious-Roman.otf
in Folder
and do this: 当我将Delicious-Roman.otf
放入Folder
并执行以下操作时:
@font-face{
font-family: Delicious;
src: url(Delicious-Roman.otf);
}
div{
font-family: Delicious;
}
its all good and it works. 一切都很好,并且有效。 Also I've seen people put format(otf);
我也看到人们把format(otf);
next to the src
, but i don't know why. 在src
旁边,但我不知道为什么。
You are probably testing this in Firefox. 您可能正在Firefox中对此进行测试。 Try Chrome and it will work. 尝试使用Chrome,它会起作用。 For the Firefox fix, see: Bootstrap 3 unable to display glyphicon properly 有关Firefox修复程序,请参见: Bootstrap 3无法正确显示glyphicon
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.