1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
---
title: font-display
slug: Web/CSS/@font-face/font-display
translation_of: Web/CSS/@font-face/font-display
---
<div>{{CSSRef}}</div>
<p>The <strong><code>font-display</code></strong> descriptor determines how a font face is displayed based on whether and when it is downloaded and ready to use.</p>
<h2 id="The_font_display_timeline">The font display timeline</h2>
<p>The font display timeline is based on a timer that begins the moment the user agent attempts to use a given downloaded font face. The timeline is divided into the three periods below which dictate the rendering behavior of any elements using the font face.</p>
<dl>
<dt>Font block period</dt>
<dd>If the font face is not loaded, any element attempting to use it must render an <em>invisible</em> fallback font face. If the font face successfully loads during this period, it is used normally.</dd>
<dt>Font swap period</dt>
<dd>If the font face is not loaded, any element attempting to use it must render a fallback font face. If the font face successfully loads during this period, it is used normally.</dd>
<dt>Font failure period</dt>
<dd>If the font face is not loaded, the user agent treats it as a failed load causing normal font fallback.</dd>
</dl>
<p>{{cssinfo}}</p>
<h2 id="Syntax">Syntax</h2>
<pre class="brush: css;">/* Keyword values */
font-display: auto;
font-display: block;
font-display: swap;
font-display: fallback;
font-display: optional;</pre>
<h3 id="Values">Values</h3>
<dl>
<dt><code>auto</code></dt>
<dd>The font display strategy is defined by the user agent.</dd>
<dt><code>block</code></dt>
<dd>Gives the font face a short block period and an infinite swap period.</dd>
<dt><code>swap</code></dt>
<dd>Gives the font face an extremely small block period and an infinite swap period.</dd>
<dt><code>fallback</code></dt>
<dd>Gives the font face an extremely small block period and a short swap period.</dd>
<dt><code>optional</code></dt>
<dd>Gives the font face an extremely small block period and no swap period.</dd>
</dl>
<h3 id="Formal_syntax">Formal syntax</h3>
{{csssyntax}}
<h2 id="Examples">Examples</h2>
<pre class="brush: css; highlight[7]">@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;
}</pre>
<h2 id="Specifications">Specifications</h2>
<table class="standard-table">
<thead>
<tr>
<th scope="col">Specification</th>
<th scope="col">Status</th>
<th scope="col">Comment</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{SpecName('CSS4 Fonts', '#font-display-desc', 'font-display')}}</td>
<td>{{Spec2('CSS4 Fonts')}}</td>
<td>Initial definition</td>
</tr>
</tbody>
</table>
<h2 id="Browser_compatibility">Browser compatibility</h2>
<p>{{Compat("css.at-rules.font-face.font-display")}}</p>
<h2 id="See_also">See also</h2>
<ul>
<li>{{cssxref("@font-face/font-family", "font-family")}}</li>
<li>{{cssxref("@font-face/font-stretch", "font-stretch")}}</li>
<li>{{cssxref("@font-face/font-style", "font-style")}}</li>
<li>{{cssxref("@font-face/font-weight", "font-weight")}}</li>
<li>{{cssxref("@font-face/font-variant", "font-variant")}}</li>
<li>{{cssxref("font-feature-settings", "font-feature-settings")}}</li>
<li>{{cssxref("@font-face/font-variation-settings", "font-variation-settings")}}</li>
<li>{{cssxref("@font-face/src", "src")}}</li>
<li>{{cssxref("@font-face/unicode-range", "unicode-range")}}</li>
</ul>
|