Home » Html » CSS @font-face not working in ie

CSS @font-face not working in ie

Posted by: admin November 30, 2017 Leave a comment

Questions:

I have the following CSS that works within Firefox but not IE. Obviously, the fonts are within the directory. Any suggestions?

@font-face {
    font-family: "Futura";
    src: url("../fonts/Futura_Medium_BT.eot"); /* IE */
    src: local("Futura"), url( "../fonts/Futura_Medium_BT.ttf" ) format("truetype"); /* non-IE */  
}

body nav {
    font-family: Futura,  Verdana, Arial, sans-serif;
    font-size:1.2em;
    height: 40px;
}
Answers:

I read a lot of tutorials that suggested hacks, so I came up with this solution I think is better… It seems to work fine.

@font-face { 
    font-family: MyFont; src: url('myfont.ttf'); 
}
@font-face{ 
    font-family: MyFont_IE; src: url('myfont.eot'); 
}
.my_font{ 
    font-family: MyFont, MyFont_IE, Arial, Helvetica, sans-serif; 
}

Questions:
Answers:

If you’re still having troubles with this, here’s your solution:

http://www.fontsquirrel.com/fontface/generator

It works far better/faster than any other font-generator and also gives an example for you to use.

Questions:
Answers:

For IE > 9 you can use the following solution:

@font-face {
    font-family: OpenSansRegular;
    src: url('OpenSansRegular.ttf'), url('OpenSansRegular.eot');
}

Questions:
Answers:

You could use the Google Font API. They say it works from IE 6 and up. (I’ve not tested this.)

Google’s serving infrastructure takes
care of converting the font into a
format compatible with any modern
browser (including Internet Explorer 6
and up), …

Questions:
Answers:

From http://readableweb.com/mo-bulletproofer-font-face-css-syntax/

Now that web fonts are supported in Firefox 3.5 and 3.6, Internet
Explorer, Safari, Opera 10.5, and Chrome, web authors face new
questions: How do these implementations differ? What CSS techniques
will accommodate all? Firefox developer John Daggett recently posted a
little roundup about these issues and the workarounds that are being
explored. In response to that post, and in response to, particularly,
Paul Irish’s work, I came up with the following @font-face CSS syntax.
It’s been tested in all of the above named browsers including IE 8, 7,
and 6. So far, so good. The following is a test page that declares the
free Droid font as a complete font-family with Regular, Italic, Bold,
and Bold Italic. View source for details. Alert: Be aware that
Readable Web has released it’s first @font-face related software
utility for creating natively compressed EOT files quickly and easily.
It has it’s own web site and, in addition to the utility itself, the
download package contains helpful documentation, a test font, and an
EOT test page. It’s called EOTFAST If you’re working with @font-face,
it’s a must-have.

Here’s The Mo’ Bulletproofer Code:

@font-face{ /* for IE */
    font-family:FishyFont;
    src:url(fishy.eot);
}
@font-face { /* for non-IE */
    font-family:FishyFont;
    src:url(http://:/) format("No-IE-404"),url(fishy.ttf) format("truetype");
}

Questions:
Answers:

Font Squirrel did not work for me. I uploaded a font for conversion to multiple font format for IE support. It performed onversion, which I was able to download. I then uploaded content to my server per specs. I was only either able to get Firefox or IE to work but not both. The solution that worked for me was The Mo Bullet Proofer link above.

Questions:
Answers:

I have found if the font face declarations are inside a media query IE (both edge and 11) won’t load them; they need to be the first thing declared in the stylesheet and not wrapped in a media query

Questions:
Answers:

Change as per below

@font-face {
    font-family: "Futura";
    src: url("../fonts/Futura_Medium_BT.eot"); /* IE */
    src: local("Futura"), url( "../fonts/Futura_Medium_BT.ttf" ) format("truetype"); /* non-IE */  
}

body nav {
     font-family: "Futura";
    font-size:1.2em;
    height: 40px;
}