简体   繁体   English

字体无法在IE或Edge中使用

[英]Font-Face not working in IE or Edge

I am using the following font-face rule: 我正在使用以下字体规则:

@font-face {
    font-family: aiCustomFont;
    src: url('../fonts/myriadpro-regular.otf') format('opentype'),
        url('../fonts/myriad pro regular.ttf') format('truetype');
}

This works exactly as expected for Safari, Chrome, and Firefox. 完全可以像Safari,Chrome和Firefox一样正常工作。 It does not work at all for IE11 and Edge. 它根本不适用于IE11和Edge。 I am not seeing any errors logging to the console or anywhere else. 我没有看到任何错误记录到控制台或其他任何地方。 I have found many articles on font issues in IE but most of them are several years old. 我已经在IE中找到许多有关字体问题的文章,但其中大多数都已经有好几年了。

Do I still need different font formats outside of TTF/OTF for the font to display in IE11/Edge? 我仍需要TTF / OTF之外的其他字体格式以使该字体显示在IE11 / Edge中吗?

If anyone stumbles across this post, I ended up just using a more web-friendly font. 如果有人偶然发现这篇文章,我最终只是使用了一种对网络更友好的字体。

Make sure your @font-face rules are NOT contained in media queries. 确保您的@ font-face规则未包含在媒体查询中。 @font-face rules contained in media queries do not work in IE, Edge, but work in every other modern browser I tested on. 媒体查询中包含的@ font-face规则不适用于IE,Edge,但适用于我测试过的所有其他现代浏览器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM