【问题标题】:Font-family CSS3 in IE7IE7 中的字体系列 CSS3
【发布时间】:2013-01-31 02:21:58
【问题描述】:

由于某种原因,我的网站导致 IE 以“文档模式 IE7”呈现。 我已经用字体版本替换了页面上的精灵和图像图标。 不幸的是,font-face css 在这个浏览器中不起作用。 当我在 IE 的开发者工具中将“文档模式”切换到 IE8 或 IE9 时,图标按预期显示。

我不明白为什么 IE7 不显示图标。据我所知,它应该可以使用该字体。

正如您在代码中看到的,我使用了来自 fontello.com 的字体文件和 css 定义。

这是我用来显示图标的样式表:

<style type="text/css">
@font-face {
 font-family: 'fontello-postbit';
 src:url(/includes/fonts/fontello-postbit.eot);
 src:url(/includes/fonts/fontello-postbit.eot?#iefix) format('embedded-opentype'),
 url(/includes/fonts/fontello-postbit.woff) format('woff'),
 url(/includes/fonts/fontello-postbit.ttf) format('truetype'),
 url(/includes/fonts/fontello-postbit.svg#fontello-postbit) format('svg');
 font-weight:normal;
 font-style:normal;
}
[class^="icon-"]:before,
[class*=" icon-"]:before {
  font-family: 'fontello-postbit';
  font-style:normal;
  font-weight:normal;
  font-size: 120%;
  display:inline-block;
  text-decoration:none;
  width:1em;
  margin-right:0.2em;
  text-align:center;
  opacity:0.8;
/* fix buttons height, for twitter bootstrap */
  line-height: 1em;
/* Animation center compensation - magrins should be symmetric */
/* remove if not needed */
  margin-right: 0.2em;
  speak: none;
}
.icon-star:before { content: '\2605'; } /* '?' */
.icon-star-empty:before { content: '\2606'; } /* '?' */
.icon-flag:before { content: '\2691'; } /* '?' */
.icon-attention:before { content: '\26a0'; } /* '?' */
/* ... etc ...*/
.icon-user:before { content: '\1f464'; } /* '\1f464' */
</style>

编辑:Duh - 我刚刚注意到 fontello 为 IE7 本身提供了一个 css 解决方法。

【问题讨论】:

    标签: internet-explorer css fonts internet-explorer-7 font-face


    【解决方案1】:

    可能是因为 IE7 无法识别 :before:after 伪元素。

    如果很关键,您可以尝试其中一些解决方案: after-and-before-css-pseudo-elements-hack-for-ie-7

    或者你可以忽略 IE7。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-08-14
      • 1970-01-01
      • 1970-01-01
      • 2014-02-10
      • 1970-01-01
      • 2014-02-02
      • 2022-01-25
      相关资源
      最近更新 更多