@font-face being ignored by IE7

后端 未结 4 1251
独厮守ぢ
独厮守ぢ 2020-12-31 18:57

I\'ve created a @font-face css rule and all the font formats using Font Squirrel and works fine on all browsers I have tested so far, but not on IE7. The font seems to not b

相关标签:
4条回答
  • 2020-12-31 19:36

    This approach i just did worked with IE7 and IE8. And yep.. font face declaration for IE7 is different, but simpler, compared to the "multiple-browser" way of declaring it. Here's my example. I added the fonts inside the "fonts" folder so you can see some "fonts/.." added in the code.

    /* declaration of custom fontfaces */
    /* first set of declaration fixes IE < v.9 issue */
    @font-face { 
                 font-family:"Open Sans Light";
                 src:url("fonts/OpenSans-Light.eot?");
               }
    
    /* if your browser is one of the latest ones, then it will recognize the code 
       below and will redeclare the font faces. 
       Since IE 7 and 8 do not recognize these declarations, 
       they will just bypass them. */
    @font-face { 
                 font-family:"Open Sans Light";
                 src:url("fonts/OpenSans-Light.eot?") format("eot"),
                    url("fonts/OpenSans-Light.woff") format("woff"),
                    url("fonts/OpenSans-Light.ttf") format("truetype"),
                    url("fonts/OpenSans-Light.svg#OpenSans-Light") format("svg");
                 font-weight:normal;font-style:normal; 
               }
    
    0 讨论(0)
  • 2020-12-31 19:41

    I found that I needed to add the file extension in IIS in the mime type as shown here http://technet.microsoft.com/en-us/library/bb742440.aspx

    0 讨论(0)
  • 2020-12-31 19:42

    I'm pretty sure it's a simple matter of "IE7 don't do that," as the kids say. Sitepoint's reference on @font-face, found at http://reference.sitepoint.com/css/at-fontface, indicates that IE only supports certain font formats via @font-face.

    0 讨论(0)
  • 2020-12-31 19:52

    It seems there was something else in my css making IE7 behave badly (shocker!)

    Thankfully using some magic fairy dust (zoom: 1) solved the issue.

    0 讨论(0)
提交回复
热议问题