Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS [Solved] Specify css mark up by font face Re: [Solved] Specify css mark up by font face

#76696
Chris Coyier
Keymaster

Both TypeKit and Google Fonts API have a WebFont Loader JavaScript thing that you can use. With that, you can do things when the font gets loaded properly, like add a class to the HTML element on the page. That way, you can apply special styling when the font is loaded properly. But if a fallback font is used, that classname won’t be applied, and your regular CSS will be used. So in your regular CSS, apply whatever you need to get the fallback font looking good.

If you don’t have access to this technology, it gets more complicated. You might need to use some font-guessing JavaScript:
http://www.whatstyle.net/articles/54/gu … javascript

I might take a crack at it and see what I can come up with. No promises =)