声明这个.otf字体有什么问题?

时间:2014-02-13 14:32:08

标签: html css fonts font-face

这是我的声明代码:

@font-face {
    font-family: 'MyOwnFont';
    font-style: normal;
    font-weight: 400;
    src: url('../webfonts/MyOwnFont.otf') format("opentype");
}

但是当我使用它时:

body
{
    font-family:'MyOwnFont';
}

我在网页上看不到它。宣言有什么问题?

1 个答案:

答案 0 :(得分:2)

通常最好通过web-font生成器运行字体,例如http://www.fontsquirrel.com/tools/webfont-generator

通过这种方式,它会生成字体的otfttf等版本,与仅仅otf字体的引用相比,它将得到更好的支持。

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