Internet Explorer @font-face is failing

前端 未结 15 1405
甜味超标
甜味超标 2020-11-27 18:07

I\'m trying to get Internet Explorer to render my pretty fonts. It\'s not working. They work fine in Firefox and I can see in my Apache access logs that IE has pulled the fo

15条回答
  •  北荒
    北荒 (楼主)
    2020-11-27 18:55

    You could convert your TTF font to the modern formats (ie. WOFF) using Transfonter and then use a strong @font-face like this:

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

    Source: https://css-tricks.com/snippets/css/using-font-face/

提交回复
热议问题