大网数据广告活动
Web 标准与前端开发

FontFace: display property

· 52CE 我爱测

The **`display`** property of the FontFace interface determines how a font face is displayed based on whether and when it is downloaded and ready to use. This property is equivalent to the CSS `font-display` descriptor.

CSS Font Loading API

The display property of the FontFace interface determines how a font face is displayed based on whether and when it is downloaded and ready to use. This property is equivalent to the CSS font-display descriptor.

When this property is used, font loading has a timeline with three periods. The lengths of the first two periods depend on the value of the property and the user agent. (See below.)

  • block period
    • : The browser invisibly prepares a fallback font. If the font face loads during this time, it's used to display the text and display is complete.
  • swap period
    • : If the font face is still not loaded, the fallback font will be shown. When the font face loads, the fallback will be swapped for the downloaded font.
  • failure period
    • : If the font face still is not loaded, the fallback font will be shown and no swap will occur.

Value

A string with one of the following values.

  • auto
    • : Use the font display strategy provided by the user agent.
  • block
    • : Gives the font face a short block period and an infinite swap period. The spec recommends 3 seconds for the block period, though this may vary from browser to browser.
  • fallback
    • : Gives the font face a short block period and a short swap period. The spec recommends 100 ms or less for the block period and 3 seconds for the swap period, though these values may vary from browser to browser.
  • optional
    • : Gives the font face a short block period and no swap period. The spec recommends 100 ms or less, though this may vary from browser to browser.
  • swap
    • : Gives the font face a 0 second block period and an infinite swap period.

Specifications

Browser compatibility

来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
MDN Web Docs / Mozilla 贡献者
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 2.5

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。