0

我在网上环顾四周,决定使用以下@font-face 实现:

我的 CSS:

@font-face {
font-family: matt;
src: url("/uploads/testing/Interstate-Regular.eot?#iefix") format('embedded-opentype')
     url("/uploads/testing/Interstate-Regular.ttf")  format('truetype');
}
h5.pleasework {
font-family: matt;
font-size:72px;
}

我的 HTML:

<head>
 <link rel="stylesheet" type="text/css" media="all" href="{stylesheet='in-store-analytics/testingStyle'}" />

</head>
<h1> this is a test </h1>

<img src="/uploads/features/featured-block_inthenumbers.png" alt="Smiley face" height="420" width="420">
<img src="/uploads/testing/awesomeness.jpg" alt="Smiley face" height="420" width="420">

<div id="happiness">
    <h5 class="pleasework"> PLEASE WORK FOR ME </h5>
</div>

无论出于何种原因,字体都不会生成,但图像会生成,这让我怀疑问题出在 src 参数中的 url 标签上。

有任何想法吗?帮助将不胜感激。

提前致谢!

4

1 回答 1

1

尝试这个...

确保放在@font-face样式表的顶部

@font-face {  
  font-family: "Interstate-Regular";  
  src: url(/uploads/testing/Interstate-Regular.eot);
  src: local("Interstate-Regular"), url(/uploads/testing/Interstate-Regular.ttf) format("truetype");
} 

h5.pleasework {
font-family: "Interstate-Regular";
font-size:72px;
}

但是,如果您只使用 .tff,那么它会如下所示:

@font-face {  
      font-family: matt;  
      src: url(/uploads/testing/Interstate-Regular.ttf) format("truetype");
    } 

h5.pleasework {
font-family: matt;
font-size:72px;
}

希望这可以帮助!

编辑:

这个网站非常有帮助:(参考章节:'@font-face 的工作原理:Easy Peasy'和'来吧,真的那么简单吗?' http://randsco.com/index.php/2009/07 /04/p680

于 2012-11-13T19:21:22.367 回答