Although CSS3 @font-face is supported by most major browsers (IE, Firefox, Chrome, and Safari), but not all. When it doesn't, your custom fonts might break the layout or come out with undesired results. In this article, I will explain the common issues with using custom fonts, picking the matching fallback web safe fonts, and how to create a perfect fallback font style with Modernizr.
Common Mistake
One common mistake that most people make when implementing custom fonts is not specifying the fallback fonts or picking the wrong fallback fonts.

Web Safe Fallback Fonts
When using custom fonts, it is important to include the web safe fonts as fallback. The fallback font helps to keep your design looking consistent when @font-face is not supported or available. The key point for selecting fallback fonts is to pick the web safe fonts that best match the custom font. For example, if the custom font is Clarendon, then the best web safe fallback font is Georgia because they both are in serif classification and they have similar font width.

Layout Issues
Because every font face has its own width, height, weight, kerning (letter-spacing), etc., some fonts are not substitutable with the web safe fonts. Take a look at the example below. It is a comparison between Wire One (custom font) and Arial (web safe font) at 36pt uppercase. As you can see, the Arial text takes more than double the space compare to Wire One text because Arial has a wider width and kerning.

This might causes layout issues as shown in the image below where the fallback font extends off the boundary.

Modernizr
Fortunately, there is a Javascript called Modernizr that can help to fix the issue as mentioned above. Modernizr is a Javascript that detects what CSS3 features are supported by the browser. It will then add a CSS class in the <html> element to indicate whether the features are supported. For example, if @font-face is not supported, it will add no-fontface class in the <html> element (eg. <html class="no-fontface">). These CSS classes are added with Javascript and they are not visible in the source code. In order to see them, you need to inspect the page element or view the generated source.

Fallback Font Styles With Modernizr (demo)
So we can use Modernizr to detect if @font-face is supported and then provide matching fallback font styles. For instance, you can adjust the styles for the fallback font (size, letter-space, weight, text-transform, etc.) to best match the custom font.

Including Modernizr
To implement Modernizr, you need to download a copy of Modernizr and include it in the html document.
<script src="js/modernizr.js"></script>
.no-fontface CSS
Then you will need an additional rule for specifying the .no-fontface. Check out this demo to see the final result.
/* wire one font */
h1 {
font-family: 'Wire One', arial, serif;
font-weight: bold;
font-size: 48px;
letter-spacing: 1px;
text-transform: uppercase;
}
/* no-faceface fallback */
.no-fontface h1 {
font-family: Arial, Helvetica, sans-serif;
font-weight: normal;
font-size: 30px;
letter-spacing: 0;
text-transform: none;
}
Great post. Thanks for sharing it.
yes … Great post. Thanks a lot
Nice tutorial!
great examples i would not of thought of testing a fallback font to make sure it stays within boundaries etc. good suggestion and post.
same here…not taken care about fallback, text size etc., thanks for this great tip.
What is point of having a fallback font for your fontface style if it’s going to just fall back to your non-fontface solution?
Such a great tutorial!
Is there a website or a way that we can test to see if the script works?
If I remove the custom font from my remote server whilst using the modernizr fallback as explained above, it doesn’t seem to pick up the modernizr fallback font. Am I testing it the wrong way?
Dale,
If I understand how Modernizr works correctly, it’s testing your browser to see if the browser supports @font-face. Whether or not your page actually uses @font-face isn’t tested. The fallback class is only activated if you are viewing the page with a browser that doesn’t support @font-face.
I think Google Fonts you shouldn’t have any problems with fonts not rendering, and you don’t have to worry about backup fonts. Since fonts load via Google. I never had a problem with it.
this has nothing to do with the problem.
if you use ie6 you will see the standard font,
no matter if it downloaded or not ;)
have fun
spammie
seems like ie is supporting fontface since ie5, my bad.
use a very very old version of firefox, safari or opera instead.
have fun
spammie
If I remove the custom font from my remote server whilst using the modernizr fallback as explained above, it doesn’t seem to pick up the modernizr fallback font. Am I testing it the wrong way?
It does not work with Firefox when web fonts are disabled (about:config > gfx.downloadable_fonts.enabled > false) and all the content is displayed with fallback fonts (e.g. Arial). So how can I test it?
probably by enabling that config variable you quote there…
but thats just a guess, maybe you will also need to reinstall your os ;)
have fun
spammie
I was thinking of finally going wild on my site redesign and finally breaking away from websafe fonts but wasn’t sure if it was a good idea – think i’ll give it a try with this fallback! Thanks!
A well executed tutorial and very informative, cheers!
Thank you, these examples are nice and people can learn more about responsive font face designs with them :)
Nice explanation!
my facebook id ene kathmandu
Hi,
Great tip. I didn`t know that was possible to use non default fonts.
Love the idea of using modernizer to protect the layout when fallback fonts need to be used.
Excellent code. It helps me a lot.
Excellent work,Love the idea of using modernizer to protect the layout,thanks for sharing.
I plan to use CSS3 @font-face on my polish fashion websitr but I’m worried about the speed load my site. It’s already loaded with plenty of photos
WoW!Nice tutorial!yes … Great post. Thanks a lot,,,,,,,,,,!~
I agree. Indicating fallback fonts is seriously important when using custom fonts. This is an extreme “must”… unless you want your layouts to get messy on other browsers or devices.
Really useful, thanks for sharing.