让页面仅加载html,html – 仅在该页面中加载@ font-face

我不知道浏览器是如何实现它的,但

CSS Fonts Module Level 3在其“

Font loading guidelines”部分中说,浏览器必须只下载当前页面中使用的字体:

The @font-face rule is designed to allow lazy loading of fonts, fonts are only downloaded when needed for use within a document. A stylesheet can include @font-face rules for a library of fonts of which only a select set are used; user agents must only download those fonts that are referred to within the style rules applicable to a given page. User agents that download all fonts defined in @font-face rules without considering whether those fonts are in fact used within a page are considered non-conformant.

所以,无论如何,在你的代码中你不能指定任何特定的行为,如果浏览器是兼容的,它将只下载每个页面所需的那些.

另一个考虑因素是浏览器是否会将当前页面中声明的字体下载为后备但未真正使用.在这种情况下,规范说它是可选的:

In cases where a font might be downloaded in character fallback cases, user agents may download a font if it’s listed in a font list but is not actually used for a given text run.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值