DEV Community


Discussion on: What is fallback font?

nataliedeweerd profile image
𝐍𝐚𝐭𝐚𝐥𝐢𝐞 𝐝𝐞 𝐖𝐞𝐞𝐫𝐝

Fallback (noun) - A fallback plan or position can be used if other plans do not succeed or other things are not available. -

So basically fallback fonts are used when the current font isn't available. For example, if your CSS selector looked like this:

h1 {
    font-family: 'Roboto', 'Open Sans', Helvetica, Arial, sans-serif;
Enter fullscreen mode Exit fullscreen mode

The website will basically parse this as:

  1. Is 'Roboto' available? No? Try the next one.
  2. Is 'Open Sans' available? No? Try the next one.
  3. Is Helvetica available? No? Try the next one.
  4. Is Arial available? No? Try the next one.
  5. Final fall-back to genetic sans-serif font.

As soon as it finds a font which is available, it will stop. So if Helvetica was available, it would simply stop there and show that font.

Final fallback's should always be generic types, e.g.

  • serif
  • sans-serif
  • cursive
  • monospace