I'm working on a site which uses the Open Sans typeface for the body text, with EOT, SVG, WOFF and TTF font files and stylesheet generated by Font Squirrel. I've included my fonts CSS first in my page header. But when I view the site in IE7, IE8 and even IE9 I get a flash of everything in Times Roman before the Open Sans kicks in. This isn't happening in the other browsers.
Can anyone suggest a way I could stop this happening? Here's the Font Squirrel CSS I'm using for that font:
@font-face {
font-family: 'OpenSansRegular';
src: url('opensans-regular-webfont.eot');
src: url('opensans-regular-webfont.eot?#iefix') format('embedded-opentype'),
url('opensans-regular-webfont.woff') format('woff'),
url('opensans-regular-webfont.ttf') format('truetype'),
url('opensans-regular-webfont.svg#OpenSansRegular') format('svg');
font-weight: normal;
font-style: normal;
}
What you see while the custom font is being downloaded isn't defined in the above code. It's defined in your other
font-family
instructions throughout your CSS code.Add other fonts after 'OpenSansRegular' value, separated by commas. From right to left:
serif
,sans-serif
,monospace
orcursive
(yay Comic Sans!). Here,OpenSansSth
is ...sans-serif
.Your browser has a default for these families, Arial, Verdana or some other font in Linux, whatever. It's the user choice when you don't choose for him. The default family is
serif
and the default font in Windows is 'Times New Roman'. That's why you see Times New Roman as a FOUC in IE.OpenSansRegular
in your siteEx:
Compatibility tables with percentages (maybe a bit old) http://www.codestyle.org/css/font-family/
Don't use 10 values, 3 to maybe 6 will be enough ;) In 2012 @font-face may cause rendering problems depending on the browser and the OS (aliasing) but it's very well supported so you can shorten your font-families.
jQuery plugin to hide FOUC of
@font-face
can be found here: How to know if a font (@font-face) has already been loaded? Removed the code block from this thread as I have been updating it over there.