Geo*_*ith 7 css crash fonts font-face internet-explorer-8
我刚在我的网站上通过@ font-face(由fontsquirrel.com生成)安装了字体Aller Regular和Aller bold .
这是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;
}
Run Code Online (Sandbox Code Playgroud)
当我在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>
Run Code Online (Sandbox Code Playgroud)
如果浏览器比IE8更新,这会在您脑海中呈现字体样式表.如果浏览器是IE8,它会将它呈现在您的身体内部.
注意:如果您支持IE7或更早版本,则可能需要调整条件注释.
小智 4
IE8似乎更喜欢双引号。这修复了我第一次加载时的无样式文本,可能会为您修复崩溃问题。
感谢这里的人,他解决了我的问题:@font-face not embedding in IE8 and under