Avoid invisible text when loading a font
It takes time to load a big font. Most browsers will hide texts until the font is loaded completely. This problem is known as flash of invisible text (FOIT).
We can prevent it from happening by asking the browser to use the system font while the custom font is still being loaded. Once the font is loaded, it will replace the system font used earlier.
This phrase is also known as flash of unstyled text (FOUT).
In order to archive it, we can use the
If you are using Google fonts
, then putting the
parameter is the equivalent way:
<link href="https://fonts.googleapis.com/css2?family=Roboto:400,700&display=swap" rel="stylesheet" />