【问题标题】:Some of custom font not working with `ie10`一些自定义字体不适用于 `ie10`
【发布时间】:2015-06-07 15:44:31
【问题描述】:

我在我的网页中使用自定义字体。我正在使用 4 种自定义字体,它们都适用于 chromefirefox,但只有一种字体(RalewayMedium)适用于 ie10 其余不工作.. 有什么问题?

这是我使用的字体:

@font-face {
    font-family: 'OpenSansLight'; /*a name to be used later*/
    src: url('../fonts/OpenSans-Light.ttf'); /*URL to font*/
}

@font-face {
    font-family: 'LatoRegular'; /*a name to be used later*/
    src: url('../fonts/Lato-Regular.ttf'); /*URL to font*/
}

@font-face { //only one works!
    font-family: 'RalewayMedium'; /*a name to be used later*/
    src: url('../fonts/Raleway-Medium.ttf'); /*URL to font*/
}
@font-face {
    font-family: 'OpenSansRegular'; /*a name to be used later*/
    src: url('../fonts/OpenSans-Regular.ttf'); /*URL to font*/
}

【问题讨论】:

标签: html css fonts internet-explorer-10


【解决方案1】:

我猜它工作正常,因为您的系统中设置了 Raleway 字体。

要使网络字体跨浏览器兼容,您需要这样做:

@font-face {
  font-family: 'MyWebFont';
  src: url('webfont.eot'); /* IE9 Compat Modes */
  src: url('webfont.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
       url('webfont.woff2') format('woff2'), /* Super Modern Browsers */
       url('webfont.woff') format('woff'), /* Pretty Modern Browsers */
       url('webfont.ttf')  format('truetype'), /* Safari, Android, iOS */
       url('webfont.svg#svgFontName') format('svg'); /* Legacy iOS */
}

查看此article 了解更多信息。

【讨论】:

  • 但是我已经在我的系统中安装了所有的字体。例如:Photoshop 显示所有字体没有任何问题。
  • @3gwebtrain 如果您从 CSS 中删除 @font-face 集,它在 Chrome 或 Firefox 中仍然有效吗?如果没有,那么您的系统中没有这些字体。或者,更有可能是您的 CSS 中的字体名称不正确(缺少空格等)。
猜你喜欢
  • 2012-10-28
  • 1970-01-01
  • 1970-01-01
  • 2012-08-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多