为什么删除@font-face中的woff2可以解决IE11问题?



这几天@font-face给我带来了麻烦。我的字体在IE11中无法显示,但在其他所有浏览器中都无法显示。

结果是,删除"woff2"字体解决了我的问题,字体显示正常。

我现在的问题是:为什么这可能是解决方案?在ie11的头脑中发生了什么,删除一个简单的"woff2"标签可能是答案?我的意思是,我通常会读到。htaccess文件和其他不太容易找到的东西。

IE11是否尝试先加载woff2 ?

ie11使用woff代替woff2。如果您想要最大的兼容性,请使用:

@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

最新更新