css - IE7 不加载 eot webfont

标签 css internet-explorer-7 font-face webfonts eot

我在使用 IE7 中的自定义图标字体包时遇到问题。它根本没有加载。它在 IE8+、FF 和 Chrome 中运行良好。 IE8 也使用 eot,所以这不是字体文件本身的问题。

在 IE11 的 IE7 模式下,网络选项卡上显示根本没有对 eot 文件的请求(但它在 IE8 模式下有,并且还在虚拟机上尝试了 native IE7)。

我也试过 Fiddler 来检查是否有请求但没有。

我正在使用以下代码嵌入字体:

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

我也试图只专注于 IE7,所以我删除了那些,只使用了这个:

@font-face {
  font-family: "Icons";
  src: url("./Icons.eot");
  font-weight: normal;
  font-style: normal;
}

仍然没有成功,Fiddler 仍然没有看到对文件的任何请求。

我正在使用 Nginx 服务器,为 eot 文件添加了以下 MIME 类型:application/vnd.ms-fontobject

此外,即使它不是跨域请求,我也添加了 Access-Control-Allow-Origin 以确保。

为什么根本没有请求的任何线索?

最佳答案

我决定采用“FontAwesome 方式”。我用 CSS 表达式创建了一个单独的 IE7 样式表。

.icon-caret-down {
    font-family: "Icons";
    *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
    font-style: normal;
}

关于css - IE7 不加载 eot webfont,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28089953/

相关文章:

javascript - react : Rendering a "please fill out this field" warning On Hover

css - 将文字包裹在 float 内

css - 为什么固定位置元素的静态定位子元素会变宽?

css - 带有 CSS 和 PNG 的假字体图标

html - @font-face 不适用于 ff、chrome 和 safari(在 mac 上)

CSS 字体不接受 'format' 语法

html - 如何使用 css 中的 flex box 实现带有 Font Awesome 图标的联系页面,比如我的图像

仅在 IE8 兼容模式和 IE7 中出现 JavaScript 错误

css - 在 IE 7 中下推的内容

jquery - 在窗口调整大小时更改字体大小