css – Safari和IE无法读取TTF和EOT字体

>我在Safari中阅读字体时遇到问题.我将OTF转换为TTF – 两种粗体和常规字体.两者都适用于Chrome和Firefox.但在Safari中,只有粗体字体才有效,而常规则不然.
> IE不读取我从网站转换的EOT字体.有没有更好的方法将OTF转换为EOT?

这是我的代码

<style type="text/css">
//Bariol_Bold
@font-face{
    font-family: Bariol_Bold;
    src:url("fonts/bariol_bold.eot"); /*For ie browser*/
}

@font-face{ 
    font-family: Bariol_Bold;
    src:url("fonts/bariol_bold.ttf"); /*For other browsers*/
}

//Bariol_Regular
@font-face{
    font-family:bariol_regular;
    src:url("fonts/bariol_regular.eot"); /*For ie browser*/
}

@font-face{ 
    font-family: bariol_regular;
    src:url("fonts/bariol_regular.ttf"); /*For other browsers*/  
</style>

<p style="font-family: Bariol_Bold; font-size: 20px;">hello world</p>
<p style="font-family: bariol_regular; font-size: 20px;">hello world</p>

解决方法

您应该检查 Paul Irish’s Bulletproof @font-face SyntaxFontSpring’s @font-face Syntax,它需要在不同文件类型中对相同字体进行多次声明,以便为多个浏览器提供服务.

基本声明就像

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

我也更喜欢FontSquirrel’s @font-face Generator,但你可以谷歌其他替代品. FontSquirrel只需要转换一种字体,它将为您提供一个基本的.zip文件,其中包含必要的字体类型以及生成的字体的示例演示.

相关文章

Css3如何实现鼠标移上变长特效?(图文+视频)
css3怎么实现鼠标悬停图片时缓慢变大效果?(图文+视频)
jquery如何实现点击网页回到顶部效果?(图文+视频)
css3边框阴影效果怎么做?(图文+视频)
css怎么实现圆角边框和圆形效果?(图文+视频教程)
Css3如何实现旋转移动动画特效