Zach’s ugly mug (his face) Zach Leatherman

A Collection of Web Font Loading Recipes

October 19, 2017

When I originally wrote A Comprehensive Guide to Font Loading Strategies, each strategy included a link to a demo showcasing it working live. For my own maintenance and organizational sanity, I’ve cleaned these demos up a bit and moved them into their own repository on GitHub.

A couple of improvements I’ve added on top of the original code:

  • Each demo using a font loading polyfill (usually fontfaceobserver) is now paired with a native CSS Font Loading API demo. The native demos are usually easier to follow—the code is simpler and there isn’t a JavaScript library embedded in the head. As we move forward and support for the CSS Font Loading API increases, we can find more creative ways to serve web fonts to browsers that don’t support it.
  • New experiments: Strategies I’m trying out that haven’t made it into The Guide yet.
  • Failed experiments: Things I wish had worked. We can learn a lot from failures too. It’s important to document these so we don’t repeat our failures.

Hopefully this is a helpful resource for you to understand the differences between the font loading strategies. It certainly will be a helpful resource for me to stay organized moving forward.


< Newer
Managing Font Loading CSS Was Painful—Not Anymore
Older >
FOIT vs. FOUT, a Side by Side Comparison

Zach Leatherman IndieWeb Avatar for https://zachleat.com/is a builder for the web at IndieWeb Avatar for https://fontawesome.com/Font Awesome and the creator/maintainer of IndieWeb Avatar for https://www.11ty.devEleventy (11ty), an award-winning open source site generator. At one point he became entirely too fixated on web fonts. He has given 84 talks in nine different countries at events like Beyond Tellerrand, Smashing Conference, Jamstack Conf, CSSConf, and The White House. Formerly part of CloudCannon, Netlify, Filament Group, NEJS CONF, and NebraskaJS. Learn more about Zach »

1 Comment
  1. Šime Vidas Disqus

    19 Oct 2017
    Idea for a custom element (FOUT w/ class case):<web-fonts font-family="Lato, sans-serif"> @font-face { font-family: Lato; src: url('lato-regular-webfont.woff2') format('woff2'), url('lato-regular-webfont.woff') format('woff'); } @font-face { font-family: Lato; src: url('lato-bold-webfont.woff2') format('woff2'), url('lato-bold-webfont.woff') format('woff'); font-weight: 700; } @font-face { font-family: Lato; src: url('lato-italic-webfont.woff2') format('woff2'), url('lato-italic-webfont.woff') format('woff'); font-style: italic; } @font-face { font-family: Lato; src: url('lato-bolditalic-webfont.woff2') format('woff2'), url('lato-bolditalic-webfont.woff') format('woff'); font-weight: 700; font-style: italic; }</web-fonts>
Shamelessly plug your related post

These are webmentions via the IndieWeb and webmention.io.

Sharing on social media?

This is what will show up when you share this post on Social Media:

How did you do this? I automated my Open Graph images. (Peer behind the curtain at the test page)