【问题标题】:Web Fonts Not Loading IE8网页字体无法加载 IE8
【发布时间】:2013-05-30 22:20:25
【问题描述】:

我不确定问题出在哪里,但我刚刚使用 Font2Web 转换了一组字体,并且我已将以下代码附加到我的 css 以呈现所需的字体,就像我通常那样。

    @font-face {
    font-family: 'Gotham Bold';
    src: url('../fonts/Gotham-Bold/fonts/Gotham-Bold.eot');
    src: url('../fonts/Gotham-Bold/fonts/Gotham-Bold.eot?#iefix') format('embedded-opentype'),
    url('../fonts/Gotham-Bold/fonts/Gotham-Bold.woff') format('woff'),
    url('../fonts/Gotham-Bold/fonts/Gotham-Bold.ttf') format('truetype'),
    url('../fonts/Gotham-Bold/fonts/Gotham-Bold.svg') format('svg');
    font-weight: normal;
    font-style: normal;
}

    @font-face {
    font-family: 'Gotham Medium';
    src: url('../fonts/Gotham-Medium/fonts/Gotham-Medium.eot');
    src: url('../fonts/Gotham-Medium/fonts/Gotham-Medium.eot?#iefix') format('embedded-opentype'),
    url('../fonts/Gotham-Medium/fonts/Gotham-Medium.woff') format('woff'),
    url('../fonts/Gotham-Medium/fonts/Gotham-Medium.ttf') format('truetype'),
    url('../fonts/Gotham-Medium/fonts/Gotham-Medium.svg') format('svg');
    font-weight: normal;
    font-style: normal;
}

结果是我的字体在 Chrome、Safari、Firefox 上渲染得很好,但 IE8 失败并且根本不加载所需的字体。

我的猜测可能是我使用的转换器可能与 EOT 文件有问题,除非有其他问题,任何建议都会很好。谢谢。

【问题讨论】:

    标签: css internet-explorer-8 webfonts


    【解决方案1】:

    见here。它说

     In Internet Explorer 8 and earlier versions, only one URL value is supported.
    

    您提供了许多 URL,所以这可能是问题所在。

    【讨论】:

    • 第一个 src 规则只有一个 URL,因此应该由 IE 8 使用,因此这表明 .eot 文件确实已损坏,正如问题中所怀疑的那样。
    • @JukkaK.Korpela 没错,第一个 .eot 文件已损坏。但是在 IE 8 上真正打破的是它只需要第一个 url 的行为,而不像现代浏览器那样使用多个。将 .eot 文件放在第一个 url 中会修复它。
    • @user568109 感谢您的回答。今晚我会检查一下。 :)
    【解决方案2】:

    我记得一个与 @font-face 相关的 IE8 问题,其中呈现

    块
    @font-face{
        ...
    }
    

    在文档的头部(或在从文档头部引用的文件中)可能会出现故障并且无法正确显示,解决的错误是将 @font-face 的那些 css 块放置在文档的正文中。

    希望有帮助

    see this question for additional details

    【讨论】:

    • 嗨,乔,谢谢您的回答,今晚我会检查一下。 :)
    猜你喜欢
    • 2014-06-09
    • 2011-12-24
    • 2015-12-08
    • 2012-11-01
    • 2016-08-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多