【问题标题】:IE7 & IE8 throwing 404 Error in TTF - font? css?IE7 和 IE8 在 TTF 中抛出 404 错误 - 字体? CSS?
【发布时间】:2015-05-07 13:00:02
【问题描述】:

我正在开发的应用程序抛出 404 错误,当 浏览器是 IE7 或 IE8。但它们适用于其他更新的版本或 在其他浏览器中。

错误是这样的:

/PresentationLayer/fonts/MyFontLt.ttf)%20format(%22truetype%22),%20url(fonts/MyFontRg.svg

在我的 CSS 文件中有这样的内容(适用于所有浏览器,IE7 和 IE8 除外):

    @font-face{
    font-family:'MyBold';
    src:url("fonts/MyFontrgbd-webfont.eot");
    src:url("fonts/MyFontrgbd-webfontd41d.eot?#iefix") format("embedded-opentype"),
    url("fonts/MyFontrgbd-webfont.woff") format("woff"),
    url("fonts/MyFontrgbd-webfont.ttf") format("truetype"),
    url("fonts/MyFontrgbd-webfont.svg#MyFontBold") format("svg");
    font-weight:400;font-style:normal}


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



    @font-face{font-family:'MyFontLight';
    src:url("fonts/MyFontRg.ttf") format("truetype");
    font-weight:400;font-style:normal}


    @font-face{
    font-family:'MyFontLight';
    src:url("fonts/MyFontLt.ttf") format("truetype"),
    url("fonts/MyFontRg.svg#MyFontRegular") format("svg");
    font-weight:400;font-style:normal}

谁能帮忙解决这个问题?

注意:

  1. 我已经尝试过 Mime-Types
  2. 嵌入的字体权限以及 可安装
  3. ...

...

【问题讨论】:

  • IE7 和 IE8 不支持 TTF,只支持 EOT。你的 EOT 字体文件存在吗?
  • 您好,EOT 字体文件存在!我还尝试添加 ** src:url("fonts/MyFontRgd41d.eot"); src:url("fonts/MyFontRgd41dd41d.eot?#iefix") ** ** font-family:'MyFontLight'; ** 但没有成功。我有同样的错误

标签: css internet-explorer-8 internet-explorer-7 http-status-code-404 font-face


【解决方案1】:

您的代码的问题是最后一个 @font-face 规则的 src 属性不包含受支持的值。因此,它将值视为一个大 url,显然,它没有指向任何地方。

要解决这个问题,只需添加 url(path/to/example.eot?#iefix) format('embedded-opentype'), 作为堆栈的第一个值。

【讨论】:

    【解决方案2】:

    您收到该错误的原因是旧版本的 IE(8 及以下)不支持真字体格式 (TTF)。正如我从错误消息中看到的那样,它只发生在您的“Light”字体中。在检查代码时,您在 @font-face 中为字体的“常规”和“粗体”版本指定了 EOT 字体,但没有为“轻”字体指定 EOT 字体。我的建议是创建“Light”字体的 .EOT 版本(您可以在许多在线站点中的任何一个中进行转换)。我个人使用过Font Squirrel。将字体文件放在选择的目录中并将其添加到您的@font-face。 Refer this site here。那应该可以解决您的问题。

    希望对你有帮助

    【讨论】:

    • 嗨,我尝试将其添加到我上面的最后两个字体代码中:src:url("fonts/MyFontrgbd-webfont.eot"); src:url("fonts/MyFontrgbd-webfontd41d.eot?#iefix") format("embedded-opentype"), 但它没有用。我想按照您所说的那样创建一个新文件,它也不起作用。你怎么看?
    • @TiagoSilva - Paul Irish 的这篇文章应该可以帮助你大展身手,让你明白你必须做什么。 paulirish.com/2009/bulletproof-font-face-implementation-syntax
    猜你喜欢
    • 2011-06-20
    • 1970-01-01
    • 2011-06-06
    • 2016-10-20
    • 1970-01-01
    • 1970-01-01
    • 2013-01-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多