@font-face在IE7中无法工作

4

我正在尝试各种不同的方法:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>

    <style type="text/css">
    @font-face {
        font-family: "cursivas";
        src: url(Freestyle.ttf) format("truetype");
    }
    @font-face {
        font-family: "tabs";
        src: url(FrutigerLTStd-Bold.otf) format("truetype");
    }
    @font-face {
        font-family: 'topMenuFont';
        src: url('frutigerltstd-bold-webfont.eot');
        src: url('frutigerltstd-bold-webfont.eot?#iefix') format('embedded-opentype'),
             url('frutigerltstd-bold-webfont.woff') format('woff'),
             url('frutigerltstd-bold-webfont.ttf') format('truetype'),
             url('frutigerltstd-bold-webfont.svg#FrutigerLTStd65Bold') format('svg');
        font-weight: normal;
        font-style: normal;
    }
    p.customfont { 
        font-family: "cursivas";

    }
    p.tabs{
        font-family:'tabs';color:#8e8e8e;
    }
    p.menu{
        font-family:'topMenuFont';
    }
    p{
    font-size:30px;
        color:#8e8e8e;
    }
    </style>
    </head>
    <body>

    <p class="customfont">FAMILIAS  <span style="color:blue">RESERVAS</span></p>
    <p class="tabs">FAMILIAS  <span style="color:blue">RESERVAS</span></p>
    <p class="menu">FAMILIAS <span style="color:blue">RESERVAS</span></p>
    <p>FAMILIAS <span style="color:blue">RESERVAS</span></p>
    </body>

</html>

路径没问题,因为它们在火狐中都能正常工作。你有什么想法吗?

我看到所有的内容都是默认字体(我猜是Arial)。 - Toni Michel Caubet
你只为frutigerltstd-bold-webfont字体导入EOT格式,而不是像Freestyle等其他字体。因此,请为所有字体生成EOT字体。 - sandeep
但仍然没有起作用。这就是为什么我正在尝试不同的字体和设置。 - Toni Michel Caubet
2个回答

2

请尝试使用此处描述的语法:

@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.com获取了该链接,他们用它来生成所有的字体。你也可以查看Google Web Font生成的css(它只显示您使用的浏览器的字体)

并将其加载到外部CSS文件中,这也可能解决一些问题。


0

如果我没记错的话,IE 7只支持使用@font-face加载EOT格式的字体,不支持TTF格式。


但是我也在导入它,不是吗? - Toni Michel Caubet

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接