【问题标题】:@font-face works for one font, not the other@font-face 适用于一种字体,而不适用于另一种
【发布时间】:2014-01-21 10:55:36
【问题描述】:

@font-face 快把我逼疯了!还有什么新东西?

我的样式表中有这段代码:

@font-face {
    font-family: BebasNeue;
    src: url('/style/fonts/bebasneue-webfont.svg#bebas_neueregular') format('svg'),
         url('/style/fonts/bebasneue-webfont.woff') format('woff'),
         url('/style/fonts/bebasneue-webfont.ttf') format ('truetype'),
         url('/style/fonts/bebasneue-webfont.eot?#iefix') format('embedded-opentype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: Quicksand;
    src: url('/style/fonts/quicksand-regular-webfont.svg#Quicksand') format('svg'),
         url('/style/fonts/quicksand-regular-webfont.woff') format('woff'),
         url('/style/fonts/quicksand-regular-webfont.ttf') format('truetype'),
         url('/style/fonts/quicksand-regular-webfont.eot?#iefix') format('embedded-opentype');
    font-weight: normal;
    font-style: normal;
}

流沙加载,贝巴斯没有。我重新下载了字体(来自 Font Squirrel),重新转换,拔掉头发,向 Odin 祈祷......

在 Chrome 的检查器中,我在 Bebas 样式表的 SVG 行上看到“无效的 CSS 属性值,但我看不出这与流沙下的同一行之间有任何区别。在 Chrome 和 FF 中,流沙-常规- webfont.woff 显示在资源下,但是 -surprise!- 不是 bebasneue-webfont.woff。

【问题讨论】:

  • 你能链接到一个活生生的例子吗?
  • 我相信你可以省略format(XXX),无论如何,你在format(之间的第一个.ttf中有一个空格。

标签: css font-face


【解决方案1】:

会不会是这里出错了:

src: url('/style/fonts/bebasneue-webfont.svg#bebas_neueregular') format('svg')

而你必须改写...#bebasneue_regular

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-06-20
    • 1970-01-01
    • 2013-03-02
    • 1970-01-01
    • 1970-01-01
    • 2014-07-07
    • 2021-07-18
    • 2019-08-06
    相关资源
    最近更新 更多