css - IE7 和 IE8 在 TTF 中抛出 404 错误 - 字体? CSS?

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

the application i am developing is throwing 404 errors when the browser is IE7 or IE8. But they work in other more recent versions or in other browsers.

错误是这样的:

/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. ...

...

最佳答案

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

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

关于css - IE7 和 IE8 在 TTF 中抛出 404 错误 - 字体? CSS?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28890038/

相关文章:

CSS 将 2 img 与链接和表单对齐

html - 在第 nth-child() 中创建更高的延迟?

html - Flexbox:如何优化 Material 设计仪表板布局

html - 在 IE6/7 中使用 CSS 将表格列中的内容居中

css - Bootstrap 下拉菜单出现在 IE7 中的 Flexslider 下方

php - 与 php 的菜单交互

html - 如何防止 knockout 从 IE8 跨度同级中剥离空文本节点

css - Font Awesome 与 HTTPS

html - 如何使用 IE8 为 HTML 表格添加透明度

javascript - 407 需要代理身份验证