【问题标题】:font face not working in ie字体在ie中不起作用
【发布时间】:2012-06-14 20:22:20
【问题描述】:

我创建了一个 html 布局并使用 css3 @font-face。这是我的代码

@font-face {
    font-family: 'MyriadProRegular';
    src: url('myriad.eot');
    src: url('myriad.eot?#iefix') format('embedded-opentype'),
         url('myriad.woff') format('woff'),
         url('myriad.ttf') format('truetype'),
         url('myriad.svg#MyriadProRegular') format('svg');
}

我正在使用

font-family: 'MyriadProRegular';

它适用于所有接受 IE 的浏览器。请帮忙。

【问题讨论】:

    标签: internet-explorer css font-face


    【解决方案1】:

    我不能为此推荐足够的字体松鼠。只需运行他们的字体生成器,您就会得到可以在 IE 中运行的代码。如果您缺少字体文件类型,它甚至会为您制作。它在过去为我节省了很多时间,我怎么推荐都不够。

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

    这是来自 Font Squirrel 并且可以跨浏览器工作:

    @font-face {
        font-family: 'NimbusSanConD-Lig';
        src: url('fonts/228BFB_1_0.eot');
        src: url('fonts/228BFB_1_0.eot?#iefix') format('embedded-opentype'),
             url('fonts/228BFB_0_0.woff') format('woff'),
             url('fonts/228BFB_0_0.ttf') format('truetype');
        font-weight: normal;
        font-style: normal;
    }
    

    【讨论】:

      【解决方案2】:

      是否是 svgwoffeot 甚至(支持的)字体类型?我很确定 .svg 不是,而且我从未听说过 .woff 和 .eot .. 只是一个 truetype 应该适用于所有浏览器。 (不过我不确定 Macintosh)

      font-face 总是适合我的方式:

      @font-face {
          font-family:alba;
          src:url(alba.ttf);
      }
      

      所以这里没有使用引号。我建议您也尝试一下,就像这样做

      @font-face {
              font-family:Myriad Pro Regular;/* note the whitespaces, I believe this is what the font itself is called (not the filename) */
              src:url(myriad.ttf);
          }
      

      请确保您始终注意大写和小写字母之间的区别!如果在您键入 myriad.ttf 时字体文件名为 Myriad.ttf,则它可能无法在某些浏览器(版本)中使用。

      【讨论】:

      • IE 需要 .eot。微软又遇难了。
      • 据我所知,但值得检查。我认为他们一直都这样做。
      • 我已经检查过了,我的方式似乎在 FF、IE、Chrome 和 Safari 中运行良好 :)
      • 我已经安装了 IE9。其他版本无法可靠检查
      • 是的。 IE Tester 充其量是参差不齐的,IE9 中的其他版本模式与实际浏览器完全不同。我不得不为 IE 7 和 8 运行虚拟机(IE 6 可能会下地狱)。我很确定您的代码不会在任何情况下运行
      猜你喜欢
      • 1970-01-01
      • 2015-08-10
      • 2012-11-13
      • 2012-11-29
      • 2018-06-08
      • 2017-10-19
      • 2013-11-02
      • 2012-10-05
      • 2013-01-21
      相关资源
      最近更新 更多