【问题标题】:linking font files in the css does not work in firefox (but works in every other browser)在 css 中链接字体文件在 firefox 中不起作用(但在其他所有浏览器中都有效)
【发布时间】:2013-08-24 22:06:50
【问题描述】:

我有以下代码:

#entrance {
    margin: 20% auto auto auto;
    text-align: center;
    font-family: 'Baron Neue';
    src: url('fonts/baron.otf');
}

这允许文本在 chrome 中以所需的字体呈现,即 safari 和 opera,但不是 firefox。我得到的只是新罗马时代。

【问题讨论】:

    标签: css firefox fonts


    【解决方案1】:

    使用@font-face 属性。

    @font-face {  
       font-family: Baron Neue;   
       src: local('Baron Neue'),   
       url('fonts/baron.otf');  
       font-weight: 400; 
    }
    

    http://sixrevisions.com/css/font-face-guide/

    【讨论】:

    • 你能告诉我为什么我需要两次local("Baron Neue")吗?
    • 如果需要,您可以在那里使用不同的字体格式。我删除了它。
    • 不同的浏览器需要不同的字体格式。要让您的网站在所有字体上正确呈现,您必须包含几 (4) 种字体格式:developer.mozilla.org/en-US/docs/Web/CSS/…
    猜你喜欢
    • 2014-08-13
    • 1970-01-01
    • 2019-08-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-05-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多