css - 买了一个@font-face,在 Firefox 和 IE 中不起作用

标签 css internet-explorer firefox fonts font-face

我的客户买了一个字体来使用。这是为其生成的代码:

@import url("//hello.myfonts.net/count/27ec77");

@font-face {font-family: 'FranklinGothicURWCon-Boo';
    src: url('www.mybariatricsolutionsseminars.com/new/styles/webfonts/27EC77_0_0.eot');
    src: url('www.mybariatricsolutionsseminars.com/new/styles/webfonts/27EC77_0_0.eot?#iefix') format('embedded-opentype'),
    url('www.mybariatricsolutionsseminars.com/new/styles/webfonts/27EC77_0_0.woff') format('woff'),
    url('www.mybariatricsolutionsseminars.com/new/styles/webfonts/27EC77_0_0.ttf') format('truetype');}

@font-face {font-family: 'FranklinGothicURWCon-Dem';
    src: url('www.mybariatricsolutionsseminars.com/new/styles/webfonts/27EC77_1_0.eot');
        src: url('www.mybariatricsolutionsseminars.com/new/styles/webfonts/27EC77_1_0.eot?#iefix') format('embedded-opentype'),
        url('www.mybariatricsolutionsseminars.com/new/styles/webfonts/27EC77_1_0.woff') format('woff'),
        url('www.mybariatricsolutionsseminars.com/new/styles/webfonts/27EC77_1_0.ttf') format('truetype');}

这适用于 Chrome,但不适用于 Firefox 或 Internet Explorer。看这里: http://www.mybariatricsolutionsseminars.com/new/

我尝试过的一些解决方案:

  1. 将此代码添加到 .htaccess。 (这没有用。)

    AddType font/ttf .ttf
    AddType font/eot .eot
    AddType font/otf .otf
    AddType font/woff .woff
    
    <FilesMatch "\.(ttf|otf|eot|woff)$">
        <IfModule mod_headers.c>
            Header set Access-Control-Allow-Origin "*"
        </IfModule>
    </FilesMatch>
    
  2. 在 src URL 上添加 http://。 (这也没有用。)

最佳答案

您的 mimetypes 设置不正确。

在 Chrome Dev Tools 中查看显示了很多:

Resource interpreted as Font but transferred with MIME type text/html

假设您使用带有 .htaccess 文件的 apache,添加:

AddType application/vnd.ms-fontobject  eot
AddType application/x-font-ttf         ttf ttc
AddType font/opentype                  otf
AddType application/x-font-woff        woff

到 .htaccess 文件。

关于css - 买了一个@font-face,在 Firefox 和 IE 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18102111/

相关文章:

css - 如何垂直居中对齐不同高度的元素的水平列表的底部

jquery - 来自 jquery-ui 的日期选择器图像

ajax - 使用ajax检测HTTP错误

javascript - jQuery 中的宽度切换动画在 FireFox 中不起作用?

javascript - 修改GM_setValue和GM_getValue用于跨表通信: How to access Firefox Preferences variables?

javascript - Jquery 和 Bootstrap 应该放在 HTML 文件的什么位置?

html - 在全屏图像上对齐按钮

javascript - IE 7 & 8 javascript 文件使用 require.js 进行缓存

internet-explorer - 如何修改 IE Gradient CSS 以使用高度和第三种颜色?

javascript - 无法在 Firefox 中通过 JavaScript 将字体系列设置为 "Arial Black"