CSS   发布时间:2022-04-17  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了css – @ font-face崩溃了IE8大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我刚刚通过@ font-face(由 fontsquirrel.com生成)在我的网站上安装了Aller Regular和Aller粗体字体.

这是CSS:

@font-face {
    font-family: 'AllerRegular';
    src: url('library/fonts/aller_rg-webfont.eot');
    src: url('library/fonts/aller_rg-webfont.eot?#iefix') format('embedded-opentype'),url('library/fonts/aller_rg-webfont.woff') format('woff'),url('library/fonts/aller_rg-webfont.ttf') format('truetype'),url('library/fonts/aller_rg-webfont.svg#AllerRegular') format('svg');
    font-weight: normal;
    font-style: normal;

}

@font-face {
    font-family: 'AllerBold';
    src: url('aller_bd-webfont.eot');
    src: url('library/fonts/aller_bd-webfont.eot?#iefix') format('embedded-opentype'),url('library/fonts/aller_bd-webfont.woff') format('woff'),url('library/fonts/aller_bd-webfont.ttf') format('truetype'),url('library/fonts/aller_bd-webfont.svg#AllerBold') format('svg');
    font-weight: normal;
    font-style: normal;

}

当我在firefox中使用以太字体时,这工作正常,但是当我使用IE8时,网页崩溃尝试重新打开并再次崩溃.一个现实的例子可以在http://rcnhca.org.uk/sites/first_steps/找到

有谁知道是什么导致了这种疯狂?

解决方法

我前一段时间遇到了同样的问题,经过一些调试我发现崩溃是因为@ font-face(在我的情况下被包含在一个名为fonts.css的单独样式表中)在< head>内部呈现. IE8有一个问题,但当我将渲染移动到< body>内部时效果很好.

试试这个:

<head>
  <!--[if gt IE 8]><!-->
    <link href="fonts.css" rel="stylesheet" type="text/css">
  <!--><![endif]-->
</head>
<body>
  <!--[if IE 8]>
    <link href="fonts.css" rel="stylesheet" type="text/css">
  <![endif]-->
  <!-- The rest of your page here -->
</body>

如果浏览器比IE8更新,则会在您脑海中呈现字体样式表.如果浏览器是IE8,它会将它呈现在您的身体内部.

注意:如果您支持IE7或更早版本,则可能需要调整条件注释.

大佬总结

以上是大佬教程为你收集整理的css – @ font-face崩溃了IE8全部内容,希望文章能够帮你解决css – @ font-face崩溃了IE8所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。