Html 为什么不';我的字体不行吗?

Html 为什么不';我的字体不行吗?,html,css,font-face,Html,Css,Font Face,我的字体适用于chrome、opera和safari,但不适用于ie或firefox。我很难理解@font-face,即使在阅读了其他关于它的问题之后 @font-face { font-family: "TikalSansBlack"; src: url("./fonts/TikalSansBlack.eot?"); src: url("./fonts/TikalSansBlack.woff") format("woff"), url("./fonts/TikalSansBlack.t

我的字体适用于chrome、opera和safari,但不适用于ie或firefox。我很难理解@font-face,即使在阅读了其他关于它的问题之后

@font-face {
font-family: "TikalSansBlack";
src: url("./fonts/TikalSansBlack.eot?");
src: url("./fonts/TikalSansBlack.woff") format("woff"),
    url("./fonts/TikalSansBlack.ttf")  format("truetype"),
    url("./fonts/TikalSansBlack.svg") format("svg")
    url("./fonts/TikalSansBlack.otf") format("opentype");
}

@font-face {
    font-family: 'TikalSansMedium';
    src: url('./fonts/TikalSansMedium.eot?');
    src: url('./fonts/TikalSansMedium.woff') format('woff'),
        url('./fonts/TikalSansMedium.ttf')  format('truetype'),
        url('./fonts/TikalSansMedium.svg') format('svg')
        url('./fonts/TikalSansMedium.otf') format('opentype');
}

@font-face {
    font-family: 'TikalSansThin';
    src: url('./fonts/TikalSansThin.eot?');
    src: url('./fonts/TikalSansThin.woff') format('woff'),
        url('./fonts/TikalSansThin.ttf')  format('truetype'),
        url('./fonts/TikalSansThin.svg') format('svg')
        url('./fonts/TikalSansThin.otf') format('opentype');
}

试试这个,如果不起作用,我会将所有源放在一行,如果不起作用,则删除format属性。(下面的修复程序在.svg后面添加了一个逗号,这在@font-face的所有3个版本中都是一个问题)


每种字体的最后一个都缺少逗号

@font-face {
font-family: "TikalSansBlack";
src: url("./fonts/TikalSansBlack.eot?");
src: url("./fonts/TikalSansBlack.woff") format("woff"),
    url("./fonts/TikalSansBlack.ttf")  format("truetype"),
    url("./fonts/TikalSansBlack.svg") format("svg"),  <<== put comma here
    url("./fonts/TikalSansBlack.otf") format("opentype");
}

请在受信任的服务(例如)上创建问题的简化测试用例。我不信任指向随机网站的链接。firefox中的CSS调试工具会告诉你你需要知道的一切MMM的路径不是有点奇怪的“url”(“./font”应该是“url”(“../font”)吗?
/
表示当前目录。它可能是你怀疑的打字错误,也可能只是
url的缩写(“字体…
。在任何情况下,这在检查控制台时都是显而易见的-您会看到“未找到文件”或类似的内容。我不敢相信我没有注意到这一点。谢谢,它在所有浏览器上都能正常工作now@Vector
/
表示“从当前文件夹开始”(例如,
font/
/font/
是相同的。)它不同于
/
,因为它指向“从域根开始”,而不是
。/
,后者是“当前文件夹之上的一个文件夹”
@font-face {
font-family: "TikalSansBlack";
src: url("./fonts/TikalSansBlack.eot?");
src: url("./fonts/TikalSansBlack.woff") format("woff"),
    url("./fonts/TikalSansBlack.ttf")  format("truetype"),
    url("./fonts/TikalSansBlack.svg") format("svg"),  <<== put comma here
    url("./fonts/TikalSansBlack.otf") format("opentype");
}
 url("../fonts/TikalSansBlack.otf")