【发布时间】:2015-11-26 05:20:42
【问题描述】:
早安,
我有一个css,代码如下:
@font-face {
font-family: 'dax-regularregular';
src: url('../fonts/daxregular-webfont.eot');
}
body {
font-family: 'dax-regularregular';
}
而且,在我的 html 代码中,我只是编写代码:
<b>this is bold</b> + this is normal
这是在 chrome 中正确显示,但在 IE 中不正确(全部变为正常,而不是粗体)。
如果我在我的 css 文件中删除 body{},那么 IE 就可以正常工作。
如果我在@font-face 中删除font-family 或src,那么 IE 将正常工作。
我在网上做了一些研究,发现.eot 文件不支持 chrome,这就是为什么 chrome 不会影响和正确显示的原因。 (不确定我的理解是否正确)
请多多指教。如果有,请提出您的解决方案。
** 编辑 **
@font-face {
font-family: 'dax-regularregular';
src: url('../fonts/daxregular-webfont.eot');
src: url('../fonts/daxregular-webfont.eot?#iefix') format('embedded-opentype'),
url('../fonts/daxregular-webfont.woff') format('woff'),
url('../fonts/daxregular-webfont.ttf') format('truetype'),
url('../fonts/daxregular-webfont.svg#dax-regularregular') format('svg'),
url('../fonts/daxbold-webfont.eot');
font-weight: normal;
font-style: normal;
}
** 编辑版本 2 ** 此解决方案可以修复 IE 9、IE 10 和 IE 11 问题。但, 该解决方案为 IE 8 引入了新问题,即普通字会加粗,而加粗字会变得“更粗”(变得更胖)。我从网上看到,IE 8 不支持 WOFF 格式的@font-face 规则(仅支持 EOT 格式)。所以,我去掉了除eot之外的那些url,但仍然面临问题。
我将我的 css 代码更改为如下,但在 IE 8 中仍然遇到同样的问题:
@font-face {
font-family: 'dax-regularregular';
src: url('../fonts/daxbold-webfont.eot');
src: url('../fonts/daxbold-webfont.eot?#iefix') format('embedded-opentype');
font-weight: bold;
font-style: normal;
}
【问题讨论】:
-
我刚刚遇到了类似的行为,但格式不同。在 Firefox 和 chrome 中工作,但它默认为默认字体。我切换到另一种支持类型的字体,它工作了
-
我觉得你也得去
.woff@。
标签: html css google-chrome fonts font-face