问题描述
这些天,我在使用@ font-face时遇到了麻烦.我的字体未在IE11中显示,但在所有其他字体中显示.
I had troubles with a @font-face these days. My font was not displaying in IE11, but in all others.
事实证明,删除"woff2"字体可以解决我的问题,并且字体可以正常显示.
Turned out that removing the "woff2" font solved my problems and the font displayed normally.
我现在的问题是:为什么这是解决方案? IE11的想法是什么,删除一个简单的"woff2"标签可能是答案?我的意思是,通常我会读到有关.htaccess文件和其他确实不容易发现的内容...
My question now is: Why could that be the solution? What is going on in IE11s mind, that removing a simple "woff2" tag could be the answer? I mean, normally I read about .htaccess files and other things which are really not easy to find out...
IE11是否先尝试加载woff2?
Does IE11 try to load the woff2 first?
推荐答案
IE 11使用woff代替woff2.如果您想要最大的兼容性,请使用此:
IE 11 use woff instead of woff2. If you want maximum compatibility use this:
@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 */
}
供参考: CSS技巧-使用@font-face
这篇关于为什么在@ font-face中删除woff2可以解决IE11问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!