10 November 2017 04:15
CSS - @font-face - CSS font-display: The Future of Font Rendering on the Web — SitePoint
Before looking in detail at the various features offered by font-display, let’s briefly consider how you might use the feature in your CSS.
First of all, font-display is not a CSS property but, as mentioned in the intro, it is a descriptor for the @font-face at-rule. This means that it must be used inside a @font-face rule, as showed in the following code:
@font-face {
font-family: 'Saira Condensed';
src: url(fonts/sairacondensed.woff2) format('woff2');
font-display: swap;
}
In this snippet I’m defining a swap value for the font Saira Condensed.
The keywords for all the available values are:
auto
block
swap
fallback
optional
1
(1 marks)