为什么IE8无法加载我的eot文件?

8
我下载了一些otf字体,然后使用https://onlinefontconverter.com将它们转换为eot格式,但当我在IE8中查看该网站时,字体不显示(在Chrome、Firefox、Opera和Android中显示)。 我的代码或eot文件可能有问题。 有人知道这是什么问题吗?
(在此处下载Roboto字体:http://www.fontsquirrel.com/fonts/roboto
(在此处转换:https://onlinefontconverter.com
STYLES.CSS
@font-face
{
    font-family: RobotoCondensed;
    src: url("Roboto-Condensed.eot");
}

@font-face
{
    font-family: RobotoCondensed;
    src: url("Roboto-Condensed.ttf");
}

.myDiv
{
    font-family: RobotoCondensed, Arial, Helvetica;
    font-size: 10px;
    color: #e8e8e8;
}

index.html(相关代码)


<div class="myDiv">Some font in here that shows incorrectly as Arial!</div>

样式表和字体文件在同一个文件夹中。

为什么 font-family = Roboto-Condensed 没有生效? - elclanrs
你可以随意命名它。 - Don Rhummy
4
你尝试使用Font Squirrel的字体生成器吗?它提供了所有浏览器所需的字体和CSS。链接为:http://www.fontsquirrel.com/fontface/generator - Joel Eckroth
4个回答

4

感谢你的帮助。看起来问题出在字体转换器上。IE浏览器无法识别eot文件。特别感谢“Joel Eckroth”建议我尝试其他转换器。


3

试试这个

        @font-face
    {
        font-family: 'RobotoCondensed';
        src: url('Roboto-Condensed.eot');
  src: url('Roboto-Condensed.eot?#iefix') format('embedded-opentype'),
         url('Roboto-Condensed.woff') format('woff'),
         url('Roboto-Condensed.ttf') format('truetype'),
         url('Roboto-Condensed.svg#') format('svg');

}

    .myDiv
    {
        font-family: RobotoCondensed, Arial, Helvetica;
        font-size: 10px;
        color: #e8e8e8;
    }

1
我遇到了一个问题,无论怎样调整和进行网络研究都没有帮助
直到我编辑了head标签,加入了meta

<head>
<meta http-equiv="Content-type" content="text/html;charset=utf-8"/>
</head>


meta标签解决了问题,每个变化都起作用!

变化1

<style type="text/css">
@font-face
{
font-family: 'SolaimanLipi';
src: url('SolaimanLipi.eot');
src: local('SolaimanLipi'),url('SolaimanLipi.ttf') format('truetype');
}
@font-face
{
font-family: 'Yogesh';
src: url('CDACOTYGN.eot');
src: url('CDACOTYGN.ttf') format('truetype');
}
</style>


变化2

我们经常认为问题很复杂,但答案往往就像大海捞针一样,藏在标签中。
您可以尝试查看源代码: http://www.weloveseppa.com/jnc/jncTryBangla.html http://www.weloveseppa.com/jnc/try1/jncTryBangla.html 适用于所有浏览器,包括旧版IE8。

0

尝试

font-family: "RobotoCondensed", Arial, Helvetica;

引号应该强制它成为您的首选选项


4
无论您是否使用引号,都不会影响选择这些字体中的哪一个。引号有助于解析器(和普通读者)确定字体名称的确切内容,但一旦名称被解析,它们的使用方式没有任何区别。 - Mr Lister

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