字体表面不工作即

时间:2012-06-14 08:17:19

标签: internet-explorer css3 font-face

我创建了一个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。请帮忙。

2 个答案:

答案 0 :(得分:3)

我不能推荐Font Squirrel。只需运行他们的Font Face生成器,您就可以获得可在IE中运行的代码。如果您错过了字体文件类型,它甚至可以为您提供。它过去给我节省了很多时间,我不能推荐它。

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

这是来自Font Squirrel并跨浏览器工作:

@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;
}

答案 1 :(得分:0)

svg woff eot 甚至(支持)字体类型?我很确定.svg不是,我从来没有听说过.woff和.eot ..只是一个truetype应该适用于所有的浏览器。 (虽然我不确定Macintosh)

font-face总是适合我的方式:

@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 ,则在某些浏览器(版本)中可能无效。

相关问题