Internet Explorer @font-face is failing

前端 未结 15 1389
甜味超标
甜味超标 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:48

    This worked for me:

    @font-face {
        font-family : 'din-pro';
        src         : url('../fonts/din/DINPro-Medium.woff') format('woff');
        src         : url('../fonts/din/DINPro-Medium.otf') format('otf');
        src         : url('../fonts/din/DINPro-Medium.ttf') format('truetype');
        font-weight : 500;
        font-style  : normal;
    }
    
    @font-face {
        font-family : 'din-pro';
        src         : url('../fonts/din/DINPro-Regular.woff') format('woff');
        src         : url('../fonts/din/DINPro-Regular.woff2') format('woff2');
        src         : url('../fonts/din/DINPro-Regular.ttf') format('truetype');
        font-weight : 400;
        font-style  : normal;
    }
    @font-face {
        font-family : 'din-pro-ie';
        src         : url('../fonts/din/DINPro-Regular.eot?');
        font-weight : 400;
        font-style : normal;
    }
    @font-face {
        font-family : 'din-pro-ie';
        src         : url('../fonts/din/DINPro-Medium.eot?');
        font-weight : 500;
        font-style : normal;
    }
    

    Notice that I defined the font for IE seperately with a -ie suffix. When using the font I would do something like p { font-family : din-pro, din-pro-ie }. Tested and working from IE5 forward using emulation.

提交回复
热议问题