预加载@font-face 字体? [英] Preloading @font-face fonts?

查看:34
本文介绍了预加载@font-face 字体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在页面加载之前预加载或以其他方式缓存 @font-face 字体(最有可能使用 javascript),以便在页面最终加载时不会出现丑陋的跳转?

Is it possible to preload or otherwise cache @font-face fonts, most likely with javascript, before the page loads so you don't get that ugly jump when the page finally does load?

推荐答案

这个答案不再是最新的

请参考这个更新的答案:https://stackoverflow.com/a/46830425/4031815

我不知道当前有什么技术可以在字体加载时避免闪烁,但是您可以通过为您的字体发送适当的缓存标头并确保该请求尽快通过来将其最小化.

I'm not aware of any current technique to avoid the flicker as the font loads, however you can minimize it by sending proper cache headers for your font and making sure that that request goes through as quickly as possible.

这篇关于预加载@font-face 字体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆