Introducing CSS’ new font-display property

Default avatar.
August 23, 2016
Introducing CSS’ new font-display property.

We take web fonts for granted these days. We didn’t always have the option of setting our text in almost any typeface. I mean, we could, but then we’d have to sigh and say, Well, that’ll look good on about five people’s computers. Hope everyone else likes Verdana!”

Web fonts brought some much needed variety to the seen, a few abuses of typography, some extra page weight as the fonts themselves were loaded, and flashes of unstyled or invisible text. Well… omelette, eggs, breaking, you get the idea. It was bound to happen. [pullquote]If users are stuck looking at a blank page for too long they might just decide to leave[/pullquote] It’s a bit of a usability problem, though, when text is invisible until the custom font gets loaded. If users are stuck looking at a blank page for too long (and too long might be milliseconds) they might just decide to leave. And that’s fair enough. It’s not user-friendly. Fast forward a few years, and we’re making progress on controlling the way fonts load. Until now, we’ve done it with third-party libraries and APIs. But now, at last, this functionality is coming to CSS. Enter the font-display property. It’s currently only in Opera, Opera for Android, and Chrome. (It was first introduced in Chrome 49 as an experimental feature.) It comes with four options: auto, swap, fallback, and optional. Basically, choosing font-display: auto will leave the browser to act as it does now. Text will be invisible until the custom font loads. swap is probably what most people will use. If the font isn’t loaded, the next available font defined in the font-family property will be used. When the web font loads, it will be replaced. This is basically a flash of unstyled content, but that’s more user-friendly than invisible content, I think. fallback splits the difference between those first two options. For a delay of 100 milliseconds, the text will be invisible. If the custom font is loaded by then, it will be used. If not, the next font in the line of succession will rule until the custom font is loaded. [pullquote]optional works like fallback, except the browser may decide not to load the custom font at all, if the user’s connection is too slow[/pullquote] optional works like fallback, except the browser may decide not to load the custom font at all, if the user’s connection is too slow. And there we have it. Mind you, the display-font is meant to be used in a @font-face declaration. That means it won’t work with third-party font providers like Typekit or Google Fonts for now. Once font-display becomes more widespread, however, it’s likely that they’ll implement some sort of option for this feature.

Ezequiel Bruni

Ezequiel Bruni is a web/​UX designer, blogger, and aspiring photographer living in Mexico. When he\‘s not up to his finely-chiselled ears in wire-frames and front-end code, or ranting about the same, he indulges in beer, pizza, fantasy novels, and stand-up comedy.

Read Next

Are Simple Websites Better For Business?

As web design technologies raise the bar on what it is possible to achieve on a realistic budget, there’s a rising deba…

Apple Opts for AR over VR at WWDC

An Apple VR headset has been one of the most widely-rumored devices of the last few years, and it was finally settled a…

Exciting New Tools for Designers, June 2023

We’re halfway through 2023 already, and the number of incredible apps, tools, and resources for designers is mounting.

3 Essential Design Trends, June 2023

This month we are focusing on three trends within a bigger website design trend – different navigation menu styles and …

15 Best New Fonts, May 2023

The choices you make when selecting a typeface have more impact on your design than almost any other decision, so it’s …

10+ Best Tools & Resources for Web Designers and Agencies (2023 updated)

Having the ability to envision a tastefully designed website (i.e., the role creativity plays) is important. But being …

20 Best New Websites, May 2023

This month, there are tons of great new agency websites to get excited about. 3D animated prisms are a popular theme, a…

How to Find the Right White Label Website Builder for Your Agency

Web design agencies face a lot of obstacles in closing the deal with new clients. One of the most common ones is the ar…

Exciting New Tools For Designers, May 2023

There are hundreds of new tools for designers and developers released each month. We sift through them all to bring you…

3 Essential Design Trends, May 2023

All three of the website design trends here mimic something bigger going on in the tech space, from a desire to have mo…

10 Best AI Tools for Web Designers (2023)

It’s time to stop worrying if AI is going to take your job and instead start using AI to expand the services you can of…

10 Best Marketing Agency Websites (Examples, Inspo, and Templates!)

Marketers are skilled in developing strategies, producing visual assets, writing text with high impact, and optimizing …