CSS3 @font-face 在 IE 9 中不工作

标签 css font-face

以下 css 在 IE9 中不工作。在 Firefox 和 Chrome 中工作。 请帮助...

<style>
    @font-face {
        font-family: 'myFirstFont';
        src: url('fonts/test/MB-ThinkTwice_Regular.ttf');
    }
    @font-face {
        font-family: 'myFirstFont_IE';
        src: url('fonts/test/MMB_ThinkTwice.eot?#iefix') format('embedded-opentype');
    }
</style>
<div style="font-family:myFirstFont, myFirstFont_IE; font-size:64px;">
    This is test TEXT
</div>

最佳答案

您可以将您的字体组合成一个定义,为 IE 创建一个单独的字体,您只需要提供所有需要的字体文件类型。下面的示例应该在 IE6-9 中工作。

@font-face {
    font-family: 'myFirstFont';
    src: url('fonts/test/MB-ThinkTwice_Regular.eot'); /* IE9 Compat Modes */
    src: url('fonts/test/MB-ThinkTwice_Regular.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
         url('fonts/test/MB-ThinkTwice_Regular.woff') format('woff'), /* Modern Browsers */
         url('fonts/test/MB-ThinkTwice_Regular.ttf')  format('truetype'), /* Safari, Android, iOS */
}

只有 IE6 到 8 才需要 #iefix

关于CSS3 @font-face 在 IE 9 中不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25806910/

相关文章:

html - 外接显示器影响Chrome字体清晰度?

HTML iso-8859-1 不显示字符 'åäö'

css - jQuery UI Accordion 定位

jquery - 防止无滚动按钮返回页面顶部

css - 装载机如何居中?

javascript - 在 chrome 扩展内容脚本中包含 ttf 文件

css - 字体会导致性能问题

css - 如何在 JavaFX 中使用后备字体?

html - Mac 上的@font-face 位置问题

javascript - 如何选择包含类名实例的链接?