1

我正在使用@font-face 来定义我自己的字体:

@font-face{ 
    font-family: HelveticaNeue;
    src: url('fonts/helvlight_regular-webfont.eot');
    src: local("☺");
    src: url('fonts/helvlight_regular-webfont.eot?#iefix') format('embedded-opentype'),
         url('fonts/helvlight_regular-webfont.woff') format('woff'),
         url('fonts/helvlight_regular-webfont.ttf') format('truetype'),
         url('fonts/helvlight_regular-webfont.svg#webfont') format('svg');
    font-weight: normal;
    font-style: normal;
}

@font-face{ 
    font-family: HelveticaNeue;
    src: url('fonts/helvlight_bold-webfont.eot');
    src: local("☺");
    src: url('fonts/helvlight_bold-webfont.eot?#iefix') format('embedded-opentype'),
         url('fonts/helvlight_bold-webfont.woff') format('woff'),
         url('fonts/helvetica_bold-webfont.ttf') format('truetype'),
         url('fonts/helvlight_bold-webfont.svg#webfont') format('svg');
    font-weight: bold;
    font-style: normal;
}

font-face 规则是在 Font Squirrel 上生成的,然后我添加了 font-weight 和 font-style 规则。我在 CSS 中使用我的自定义字体,如下所示:

body {
    font: 16px HelveticaNeue, Verdana, sans-serif;
    color: black;
}

h1 {
    font-weight: bold;
    font-size: 2em;
}

它在 Chrome、Firefox、Opera 和 Safari 中运行良好,但在 Internet Explorer 中无法运行。

我试过这个@font-face 在 IE8 中工作,但在 IE9中没有成功。

我还尝试将粗体样式的字体名称更改为 HelveticaNeueBold 并像这样使用它:

h1 {
    font-family: HelveticaNeueBold;
    font-size: 2em;
}

它有效,但这当然不是我想要的。在粗体之后添加 !important 也无济于事。有什么建议我做错了吗?

4

1 回答 1

3

IE 不支持使用与规则font-weight中指定的不同的值@font-face

你可以在这里阅读更多相关信息:@font-face IE9 font-weight doesn't work

于 2013-08-08T14:16:24.450 回答