font-display
Quick Summary for font-display (@font-face)
The font-display descriptor determines how a font face is displayed based on whether and when it is downloaded and ready to use.
Code Usage for font-display (@font-face)
/* Keyword values */ font-display: auto; font-display: block; font-display: swap; font-display: fallback; font-display: optional; 
More Details for font-display (@font-face)

font-display

The font-display descriptor determines how a font face is displayed based on whether and when it is downloaded and ready to use.

Syntax

/* Keyword values */ font-display: auto; font-display: block; font-display: swap; font-display: fallback; font-display: optional; 

Values

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.

Note: In Firefox, the preferences gfx.downloadable_fonts.fallback_delay and gfx.downloadable_fonts.fallback_delay_short provide the duration of the "short" and "extremely small" periods, respectively.

Description

The font display timeline

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.

Font block period

If the font face is not loaded, any element attempting to use it must render an invisible fallback font face. If the font face successfully loads during this period, it is used normally.

Font swap period

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.

Font failure period

If the font face is not loaded, the user agent treats it as a failed load causing normal font fallback.

Formal definition

Related at-rule@font-face
Initial valueauto
Computed valueas specified

Formal syntax

[ auto | block | swap | fallback | optional ]

Examples

Specifying fallback font-display

@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; } 

Specifications

Specification
CSS Fonts Module Level 4 # font-display-desc

See also

font-family font-stretch font-style font-weight font-variant font-feature-settings font-variation-settings src unicode-range

Last modified: Aug 12, 2021, by MDN contributors

Select your preferred language English (US)EspañolFrançais日本語한국어Русский中文 (简体) Change language

No Items Found.

Add Comment
Type in a Nick Name here
 
Other Categories in CSS
css
Search CSS
Search CSS by entering your search text above.
Welcome

This is my test area for webdev. I keep a collection of code here, mostly for my reference. Also if i find a good link, i usually add it here and then forget about it. more...

Subscribe to weekly updates about things i have added to the site or thought interesting during the last week.

You could also follow me on twitter or not... does anyone even use twitter anymore?

If you found something useful or like my work, you can buy me a coffee here. Mmm Coffee. ☕

❤️👩‍💻🎮

🪦 2000 - 16 Oct 2022 - Boots
Random Quote
The problem with hoarding is you end up living off your reserves. Eventually, you’ll become stale. If you give away everything you have, you are left with nothing. This forces you to look, to be aware, to replenish. . . . Somehow the more you give away, the more comes back to you.
Paul Arden
Random CSS Property

@charset

The @charset CSS at-rule specifies the character encoding used in the style sheet. It must be the first element in the style sheet and not be preceded by any character; as it is not a nested statement, it cannot be used inside conditional group at-rules. If several @charset at-rules are defined, only the first one is used, and it cannot be used inside a style attribute on an HTML element or inside the <style> element where the character set of the HTML page is relevant.
@charset css reference