6
<!doctype html>
<html>
  <head>
    <title>Test Ubuntu</title>
    <link href="http://fonts.googleapis.com/css?family=Ubuntu:regular" rel="stylesheet" type="text/css" />
    <style>
    body { font-family: 'Ubuntu', sans-serif; }
    </style>
  </head>
  <body>
    Test Ubuntu
  </body>
</html>

在 chrome 和 firefox 中显示字体...但在 ie9 中,如果我添加doctype行,它会中断!?没有它就可以正常工作。

如果可能的话,我想让它在所有三个浏览器中工作(使用 doctype?因为有时像 css 这样的其他东西依赖于那里有 doctype?或者没有它看起来不正确)?

谢谢!

4

3 回答 3

3

实际上,这似乎是一个功能。如果您打开开发人员工具栏 (F12),选择“脚本”选项卡,然后在此测试页面上点击刷新,您应该会看到如下内容:

CSS3117: @font-face failed cross-origin request. Resource access is restricted. font?kit=_tMhxyW6i8lbI7YsUdFlGA

看起来这在另一个帖子中得到了回答。

于 2011-03-10T03:58:44.490 回答
2

您能否尝试将 STYLE 元素中的内容添加到 css 文件中,并将 STYLE 替换为引用它的 LINK 元素?

IE 在外部脚本之前执行内联脚本,这可能是一个类似的错误/功能。

于 2011-03-09T19:45:15.877 回答
0

如果我添加

<meta http-equiv="X-UA-Compatible" content="IE=8" />

然后我可以在不破坏 ie9 中的字体的情况下重新添加 doctype 行。

谢谢 :)

于 2011-02-26T20:03:22.753 回答