This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
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.)
var display = FontFace.display FontFace.display = display
A CSSOMString
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.Specification | Status | Comment |
---|---|---|
CSS Font Loading Module Level 3 The definition of 'display' in that specification. | Working Draft | Initial definition. |
CSS Fonts Module Level 4 The definition of 'font-display' in that specification. | Working Draft | Defines the values for the display property. (They are the same as for font-display .) |
Desktop | ||||||
---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
Basic support | 60 | ? | No | ? | 47 | No |
Mobile | |||||||
---|---|---|---|---|---|---|---|
Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
Basic support | 60 | 60 | ? | No | 47 | No | ? |
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/FontFace/display