2012-06-14 64 views
1

我已经创建了一个html布局,并使用css3 @font-face。这里是我的代码字体面不工作,即

@font-face { 
    font-family: 'MyriadProRegular'; 
    src: url('myriad.eot'); 
    src: url('myriad.eot?#iefix') format('embedded-opentype'), 
     url('myriad.woff') format('woff'), 
     url('myriad.ttf') format('truetype'), 
     url('myriad.svg#MyriadProRegular') format('svg'); 
} 

,我使用

font-family: 'MyriadProRegular'; 

它的工作在所有浏览器IE接受。请帮忙。

回答

3

我不能推荐足够的字体松鼠。只需运行他们的Font Face生成器,就可以获得可在IE中使用的代码。如果你错过了一个字体文件类型,它甚至会为你做。这为我节省了很多时间,我不能推荐它。

http://www.fontsquirrel.com/fontface/generator

这是从字体松鼠和作品的跨浏览器:

@font-face { 
    font-family: 'NimbusSanConD-Lig'; 
    src: url('fonts/228BFB_1_0.eot'); 
    src: url('fonts/228BFB_1_0.eot?#iefix') format('embedded-opentype'), 
     url('fonts/228BFB_0_0.woff') format('woff'), 
     url('fonts/228BFB_0_0.ttf') format('truetype'); 
    font-weight: normal; 
    font-style: normal; 
} 
0

SVGWOFFEOT甚至(支持)的字体类型?我很确定.svg不是,我从来没有听说过.woff和.eot ..只是一个truetype应该在所有browswers工作。 (我不知道苹果虽然)

方式字型脸总是对我的作品:

@font-face { 
    font-family:alba; 
    src:url(alba.ttf); 
} 

所以这里没有使用引号。我建议也试图为你的情况,就是这样做,就像

@font-face { 
     font-family:Myriad Pro Regular;/* note the whitespaces, I believe this is what the font itself is called (not the filename) */ 
     src:url(myriad.ttf); 
    } 

确保你总是介意大写和小写字母之间的区别!如果字体文件被称为Myriad.ttf而您键入myriad.ttf,它可能无法在某些浏览器(版本)中工作。

+0

.eot是IE需要的。微软再次陷入困境。 – SpaceBeers

+0

我应该知道:p是否有新的IE浏览器的一些更新? – poepje

+0

据我所知,不值得检查。我认为他们一直这样做。 – SpaceBeers