2014-09-12 39 views
0

以下css不能在IE9中工作。在Firefox和Chrome中工作。 请帮助...CSS3 @ font-face不能在IE 9中工作

<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> 
+1

的[@的CSS字体面不IE9工作]可能重复(http://stackoverflow.com/questions/16710972/css-font需要IE6 -face-not-working-in-ie9) – Raptor 2014-09-12 11:09:12

+0

有两件事要检查 - 第二个例子中有“MMB_”,但第一个例子中有“MB_”。在文件名中输入错字?另外,EOT文件中的font-family实际上是以尾随的“_IE”命名的? – 2014-09-12 11:09:24

+1

*旁注:*'font-family'应该至少有一个通用字体作为后备 – Raptor 2014-09-12 11:09:50

回答

0

您可以创建一个separte字体为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 */ 
} 

的#iefix仅通过8