css字体代码不能在IE7 / 8上运行

时间:2012-11-07 18:59:42

标签: css internet-explorer fonts internet-explorer-7 font-family

我使用font-squirrel生成Web字体并为字体指定CSS声明,但当我使用IE7或IE8浏览器和文档模式在IE9中查看页面时,它仍使用后备字体。知道发生了什么事吗?这是我的代码(和屏幕截图):

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


.cubano { font-family: 'cubanoregular' }

enter image description here

3 个答案:

答案 0 :(得分:2)

如果您输入的代码准确无误,那么唯一的问题是您的eot文件路径不正确:

src: url('../fonts/cubano/cubano/../fonts/cubano/cubano-regular-webfont.woff-webfont.eot');...

修复它,它应该可以正常工作。从第5版开始,IE支持@font-face,但在9之前的版本中,仅支持eot

答案 1 :(得分:0)

您的代码没有问题,问题似乎是字体。但如果你愿意,它就在Typekit上。

答案 2 :(得分:0)

检查src路径是否正确

src: url('../fonts/cubano/cubano/../fonts/cubano/cubano-regular-webfont.woff-webfont.eot');
    src: url('../fonts/cubano/cubano-regular-webfont.woff-webfont.eot?#iefix') format('embedded-opentype'),
        url('../fonts/cubano/cubano-regular-webfont.woff-webfont.woff') format('woff'),
        url('../fonts/cubano/cubano-regular-webfont.woff-webfont.ttf') format('truetype'),
        url('../fonts/cubano/cubano-regular-webfont.woff-webfont.svg#../fonts/cubano/cubanoregular') format('svg');

可能需要

src: url('../fonts/cubano/cubano-regular-webfont.woff-webfont.eot');
src: url('../fonts/cubano/cubano-regular-webfont.woff-webfont.eot?#iefix') format('embedded-opentype'),
    url('../fonts/cubano/cubano-regular-webfont.woff-webfont.woff') format('woff'),
    url('../fonts/cubano/cubano-regular-webfont.woff-webfont.ttf') format('truetype'),
    url('../fonts/cubano/cubano-regular-webfont.woff-webfont.svg#../fonts/cubano/cubanoregular') format('svg');
相关问题