【问题标题】:font not working on index page in firefox字体在 Firefox 的索引页上不起作用
【发布时间】:2014-08-22 09:13:59
【问题描述】:

我在此网页上使用 Helvetica Neue Light 和 Fontawesome。这些字体在 Chrome 和 Safari 以及 Firefox 的 INDEX 页面上工作正常,但在 Firefox 的所有其他页面上它们都不起作用。

这是我的@font-face 代码:

@font-face {
    font-family: 'HelveticaNeue-Light';
    src: url('HelveticaNeue-Light.eot') format('embedded-opentype'), 
         url('HelveticaNeue-Light.woff') format('woff'), 
         url('HelveticaNeue-Light.ttf')  format('truetype'),
         url('HelveticaNeue-Light.svg#HelveticaNeue-Light') format('svg');
}

我尝试将此代码插入到我的 .htaccess 文件中:

<FilesMatch "\.(ttf|otf|eot|woff)$">
    <IfModule mod_headers.c>
        Header set Access-Control-Allow-Origin "*"
    </IfModule>
</FilesMatch>

我最终尝试了以下方法,并且成功了:

  1. 在地址栏中输入“about:config”;
  2. 搜索“security.fileuri.strict_origin_policy”并将其设置为 false。

但是,有什么方法可以让字体显示出来,而不必篡改 Firefox 中的设置?

【问题讨论】:

    标签: css .htaccess firefox fonts font-awesome


    【解决方案1】:

    我总是在 Firefox 中遇到字体渲染问题。尝试为您的文件使用完整的 URL(不带 www),几个月前它对我有用。:

    @font-face {
    font-family: 'HelveticaNeue-Light';
    src: url('http://yourwebsite.com/fonts/HelveticaNeue-Light.eot') format('embedded-opentype'), 
         url('http://yourwebsite.com/fonts/HelveticaNeue-Light.woff') format('woff'), 
         url('http://yourwebsite.com/fonts/HelveticaNeue-Light.ttf') format('truetype'),
         url('http://yourwebsite.com/fonts/HelveticaNeue-Light.svg#HelveticaNeue-Light') format('svg');}
    

    【讨论】:

      猜你喜欢
      • 2018-03-21
      • 2012-06-18
      • 2014-04-03
      • 1970-01-01
      • 2016-02-24
      • 1970-01-01
      • 2012-10-21
      • 2013-11-07
      相关资源
      最近更新 更多