浏览器兼容性和字体

时间:2014-04-07 12:54:52

标签: css html5

我正在制作一个HTML页面。 Page在firefox和google chrome中工作得很好,但在7和8中没有工作。 IE 7和8没有得到字体的路径,我的HTML页面不在中心位置。有人请告诉我如何解决它

@font-face {
font-family: 'AntonioRegular';
src: url('font/antonio-regular.eot');
src: url('font/antonio-regular.eot') format('embedded-opentype'),
     url('font/antonio-regular.woff') format('woff'),
     url('font/antonio-regular.ttf') format('truetype'),
     url('font/antonio-regular.svg#AntonioRegular') format('svg');

}
body
{
margin:0px;
padding:0px;
}

#wrapper
{
 width:1058px;
 height:1000px; 
 margin:0 auto;

}

2 个答案:

答案 0 :(得分:0)

尝试在第一个网址中添加一个门/尖锐字符(#)。

@font-face {
font-family: 'AntonioRegular';
   src: url('font/antonio-regular.eot');
   src: url('font/antonio-regular.eot?#iefix') format('embedded-opentype'),
        url('font/antonio-regular.woff') format('woff'),
        url('font/antonio-regular.ttf') format('truetype'),
        url('font/antonio-regular.svg#AntonioRegular') format('svg');

}

见这里:How to Get IE8 to Support HTML5 Tags and Web Fonts

或者EOT文件本身可能已损坏。

尝试删除其他浏览器的其他src,然后让第一个EOT文件进入。是IE7 / 8显示字体吗?

答案 1 :(得分:0)

这是正确的。

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