css - Internet Explorer 8 中的字体问题

标签 css internet-explorer fonts internet-explorer-8 font-face

我为 IE 8 创建了一个测试页面,看看我是否可以使用 Google 字体。您可以在问题末尾找到代码。

我通过使用带有列表的元素来包含我需要的所有 Google 字体。

现在,根据元素中 HREF 属性的长度,Google 字体可能无法在 IE 8 中使用。

案例如下:

如果我有:

<link rel=stylesheet type="text/css"
    href="//fonts.googleapis.com/css?family=Tangerine|Open+Sans|Droid+Sans|PT+Sans|Josefin+Slab|Arvo|Lato" />

Google 字体不能在 IE 8 中使用。

现在,如果我删除“Lato”,最后指定的字体:

<link rel=stylesheet type="text/css"
    href="//fonts.googleapis.com/css?family=Tangerine|Open+Sans|Droid+Sans|PT+Sans|Josefin+Slab|Arvo" />

Google 字体在 IE 8 中正常工作。

在这两种情况下,它们在 Chrome 中都运行良好,这仅与 IE 8 相关。

测试页面的HTML代码:

<html>
<head>
<link rel=stylesheet type="text/css"
  href="//fonts.googleapis.com/css?family=Tangerine|Open+Sans|Droid+Sans|PT+Sans|Josefin+Slab|Arvo|Lato" />

<style>
div {
  font-size: 36px;
  font-family: 'Tangerine'; /* here is the google font */
}
</style>

</head>
<body>
  <div>This div will get the google font family</div>
</body>
</html>

最佳答案

是的,这是 IE 的问题 - 对于 IE8 及以下版本 - 一种解决方案是在条件语句中分离出每种字体的链接 - 它不喜欢链接属性中的长字体堆栈跟踪。

<!--[if lte IE 8]>
    <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Tangerine" /> 
    <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans" /> 
    <link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Droid+Sans" />
<![endif]-->

关于css - Internet Explorer 8 中的字体问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30650026/

相关文章:

html - 从单个 png 图像获取图标

css - HTML5 标签与自动调整大小的 Div

javascript - window.print() CSS 未在打印预览中加载

css - 尝试在 Font Awesome 中使用 fontawesome-webfont.woff 时出错

css - 如何更改iconmoon字体的内容值?

javascript - 字体仅在之前在页面中使用过后才会出现在 Canvas 上

CSS:全尺寸背景图片

javascript - $state.go 无法在 Internet Explorer 中运行

internet-explorer - Internet Explorer 中的 Selenium WebDriver 单击问题

unicode - 为什么没有一种字体包含所有 Unicode 字形?