Firefox webfonts无法加载

use*_*181 17 css firefox css3 font-face

我只在Firefox中遇到webfonts的问题,所有其他浏览器(包括IE)都能很好地工作.

我的问题是webfonts根本不会加载.

我看过这个可能的解决方案,编辑htaccess文件(http://www.fontsquirrel.com/blog/2010/11/troubleshooting-font-face-problems),但我没有运气.

我唯一可以说的是在Firefox的错误控制台中我得到以下警告:

解析"src"的值时出错.跳到下一个宣言.

这是我的font-face代码示例:

@font-face {
    font-family:AngelinaRegular;
    src:url(../fonts/angelina-webfont.eot);
    src:url(../fonts/angelina-webfont.eot?iefix) format(eot), url(../fonts/angelina-webfont.woff) format(woff), url(../fonts/angelina-webfont.ttf) format(truetype), url(../fonts/angelina-webfont.svg#webfontOvuhCGpN) format(svg);
    font-weight:normal;
    font-style:normal;
}
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?

rjb*_*rjb 29

根据我的经验,Firefox对于预期@font-face规则中的引用很挑剔:

@font-face {
    font-family: AngelinaRegular;
    src: url('../fonts/angelina-webfont.eot');
    src: url('../fonts/angelina-webfont.eot?#iefix') format('embedded-opentype'),
        url('../fonts/angelina-webfont.woff') format('woff'),
        url('../fonts/angelina-webfont.ttf') format('truetype'),
        url('../fonts/angelina-webfont.svg#webfontOvuhCGpN') format('svg');
    font-weight: normal;
    font-style: normal;
}
Run Code Online (Sandbox Code Playgroud)

  • **不要忘记在`format()`中添加引号!**:) (2认同)

Ric*_*vin 11

Firefox中的字体也可能存在跨域问题.请参阅:http://www.cssbakery.com/2010/07/fixing-firefox-font-face-cross-domain_25.html