【问题标题】:Rails custom font does not work for both firefox & IERails 自定义字体不适用于 firefox 和 IE
【发布时间】:2017-07-09 13:04:53
【问题描述】:

我正在尝试在我的 rails 应用程序上使用 SegoePrint 字体。我在 app/assets/fonts 中有两个文件

SegoePrint.ttf

SegoePrint.eot

如果我有,在我的样式表中

@font-face {
font-family: "SegoePrint";        
src: url(SegoePrint.ttf) format("truetype");
}

它仅适用于 firefox,不适用于 IE,但如果我有的话

@font-face {
font-family: "SegoePrint";        
src: url(SegoePrint.ttf) format("truetype");
src: url(SegoePrint.eot);
src: url(SegoePrint.eot?#iefix) format("embedded-opentype");
}

我只为 IE 工作,不再为 firefox 工作。什么是让它适用于两种浏览器的正确语法?谢谢。

【问题讨论】:

    标签: css ruby-on-rails fonts


    【解决方案1】:

    如果你在下面使用这个语法怎么样

    @font-face {
        font-family: 'SegoePrint';
        src: asset-url('SegoePrint.eot');
        src: asset-url('SegoePrint.eot') format('embedded-opentype'),
             asset-url('SegoePrint.ttf') format('truetype');
        font-weight: normal;
        font-style: normal;
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-10-28
      • 1970-01-01
      • 2016-11-21
      • 1970-01-01
      • 2012-01-27
      • 2012-02-14
      相关资源
      最近更新 更多