font-display
descriptor determines how a font face is displayed based on whether and when it is downloaded and ready to use.
/* Keyword values */ font-display: auto; font-display: block; font-display: swap; font-display: fallback; font-display: optional;
auto
The font display strategy is defined by the user agent.
block
Gives the font face a short block period and an infinite swap period.
swap
Gives the font face an extremely small block period and an infinite swap period.
fallback
Gives the font face an extremely small block period and a short swap period.
optional
Gives the font face an extremely small block period and no swap period.
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.
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.
If the font face is not loaded, the user agent treats it as a failed load causing normal font fallback.
| 相关 at-rule |
@font-face
|
|---|---|
| 初始值 |
auto
|
| 计算值 | 如指定 |
[ auto | block | swap | fallback | optional ]
@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;
}
| 规范 | 状态 | 注释 |
|---|---|---|
|
CSS Fonts Module Level 4
The definition of 'font-display' in that specification. |
工作草案 | 初始定义 |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
font-display
|
Chrome 完整支持 72 | Edge 完整支持 79 | Firefox 完整支持 58 | IE 不支持 No | Opera 完整支持 60 | Safari 完整支持 11.1 | WebView Android 完整支持 72 | Chrome Android 完整支持 72 | Firefox Android 完整支持 58 | Opera Android 完整支持 51 | Safari iOS 完整支持 11.3 | Samsung Internet Android 完整支持 11.0 |
完整支持
不支持
font-family
font-stretch
font-style
font-weight
font-variant
font-feature-settings
font-variation-settings
src
unicode-range
font
font-family
font-feature-settings
font-kerning
font-language-override
font-optical-sizing
font-size
font-size-adjust
font-smooth
font-stretch
font-style
font-synthesis
font-variant
font-variant-alternates
font-variant-caps
font-variant-east-asian
font-variant-ligatures
font-variant-numeric
font-variant-position
font-variation-settings
font-weight
line-height
line-height-step