Css @ font-face在ie9中不起作用

Chr*_*ris 2 css internet-explorer css3 webfonts internet-explorer-9

我设法使用自定义字体,该字体适用于每个值得称为"浏览器"的浏览器.以及一如既往的酷的东西并不适用于IE浏览器(在这种情况下,IE9).

我尝试了以下方法:

@font-face { font-family: Roboto; src: url('../fonts/roboto/Roboto-Regular.ttf');}
Run Code Online (Sandbox Code Playgroud)

经过一些提示,我在google上找到了这个,我尝试过:

@font-face { font-family: Roboto; src: url('../fonts/roboto/Roboto-Regular.ttf');
                              src: url('../fonts/roboto/Roboto-Regular.ttf#') format('truetype');
                              font-weight: normal;
                              font-style: normal;}
Run Code Online (Sandbox Code Playgroud)

仍然没有成功.正如我所知,根据经验,这个问题不会有"好"的解决办法,但也许有人发现另一个坏的,即黑客让我脱离另一个即痛苦.

mar*_*595 12

您需要添加格式.eot才能被IE9识别.

@font-face {
    font-family: 'MyWebFont';
    src: url('webfont.eot'); /* IE9 Compat Modes */
    src: url('webfont.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
         url('webfont.woff') format('woff'), /* Modern Browsers */
         url('webfont.ttf')  format('truetype'), /* Safari, Android, iOS */
         url('webfont.svg#svgFontName') format('svg'); /* Legacy iOS */
    }
Run Code Online (Sandbox Code Playgroud)

资源