--- title: font-display slug: Web/CSS/@font-face/font-display tags: - CSS - 参考 - 字体 translation_of: Web/CSS/@font-face/font-display ---
font-display 属性决定了一个@font-face 在不同的下载时间和可用时间下是如何展示的。
字体显示时间线基于一个计时器,该计时器在用户代理尝试使用给定下载字体的那一刻开始。时间线分为三个时间段,在这三个时间段中指定使用字体的元素的渲染行为。
{{cssinfo}}
/* 关键字值 */ font-display: auto; font-display: block; font-display: swap; font-display: fallback; font-display: optional;
autoblockswapfallbackoptional@ font-face {
font-family: ExampleFont;
src: url(/path/to/fonts/examplefont.woff)format('woff'),
url(/path/to/fonts/examplefont.eot)format('eot');
font-weight: 400;
font-style: normal;
font-display: fallback;
}
| 规范 | 状态 | 备注 |
|---|---|---|
| {{SpecName('CSS4 Fonts', '#font-display-desc', 'font-display')}} | {{Spec2('CSS4 Fonts')}} | 初始定义 |
{{Compat("css.at-rules.font-face.font-display")}}