internet-explorer - IE7 中的字体系列 CSS3

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

出于某种原因,我的网站导致 IE 以“文档模式 IE7”呈现。 我用字体版本替换了页面上的 Sprite 和图像图标。 不幸的是,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>

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

最佳答案

可能是因为 :before:after 伪元素不被 IE7 识别。

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

或者您可以忽略 IE7。

关于internet-explorer - IE7 中的字体系列 CSS3,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14593169/

相关文章:

jquery - 为什么我无法使用 jQuery 在 IE 中淡出该表行?

javascript - JQuery 淡出

c# - .Net 枚举 winforms 字体样式?

firefox - 如何阻止Firefox中的某种字体?

string - 如何在QLabels中显示国际脚本?

javascript - 为什么 IE XDomainRequest 不发送 Referer 头

javascript - documentElement 没有子元素

html - 在 Internet Explorer 中使用自动对焦时模态中奇怪的光标放置

html - 当页面宽度较低时,将两列(div)彼此对齐

php - 与 php 的菜单交互