2013-03-22 49 views
0

我很难得到这@ @ font-face字体替换工作crossbrowser请你帮忙。它可以工作在所有,但即9或全部工作,但即7和ie 8.@ font-face字体替换工作crossbrowser

我有一个.eot .otf .svg字体。 ttf .woff?

感谢

/* works in all but ie 9 */ 
    @font-face { 
     font-family: 'Deutsch'; 
     src: url('/fonts/Deutsch.eot'); 
     src: local('/fonts/Deutsch'), 
      url('/fonts/Deutsch.ttf') format('truetype'), 
      url('/fonts/Deutsch.svg#font') format('svg'); 
    } 
    /*from [http://blog.themeforest.net/tutorials/how-to-achieve-cross-browser-font-face-support/][1] */ 


    /* works in all but ie 7 and ie 8 */ 
    @font-face { 
     font-family: 'Deutsch'; 
     src: url('/fonts/Deutsch.ttf'), 
      url('/fonts/Deutsch.eot'); /* IE9+ */ 
    } 
    /*from [http://w3schools.com/css3/css3_fonts.asp][2]*/ 

<!DOCTYPE html> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
    <title></title> 

    <style type="text/css"> 



     /* code place holder location for css */ 



     #test 
     { 
      font-family:'Deutsch'; 
      font-weight:bold; 
      text-decoration:underline; 
      font-style:italic; 
      font-size:30px; 
     } 

    </style> 




</head> 
<body> 

    <div id="test">text goes here</div> 

</body> 
</html> 
+0

更改您的文档类型........在您的html中删除此行xmlns =“http://www.w3.org/1999/xhtml” – 2013-03-22 07:26:21

+0

仍然无效 – 2013-03-22 07:28:03

+0

检查此链接.. http: //reference.sitepoint.com/css/at-fontface 它显示字体的兼容性 – oscprofessionals 2013-03-22 07:45:16

回答

2

首先重写FONT-FAMILY像下面,

font-family: 'Deutsch', sans-serif; 

如果不是,你必须使用一个网站,这个,它会将您的ttf格式转换为其他不同格式的字体...

选中此项,http://www.fontsquirrel.com/fontface/generator

+0

松鼠做到了这一招谢谢 – 2013-03-22 08:31:04

+0

欢迎您....... – SaurabhLP 2013-03-22 08:34:04

0

我只是想分享这个,因为这似乎工作。

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

和Squirel出来把这个