【问题标题】:CSS ignoring @font-face declarationsCSS 忽略 @font-face 声明
【发布时间】:2013-08-21 15:12:48
【问题描述】:

我的 CSS 中有两个 @font-face 分配。只有第二个/最后一个会渲染,尽管它们几乎相同。

    @font-face {
    font-family: 'callunaregular';
    src: url('callunaregular/Calluna-Regular-webfont.eot');
    src: url('callunaregular/Calluna-Regular-webfont.eot?#iefix') format('embedded-opentype'),
         url('callunaregular/Calluna-Regular-webfont.woff') format('woff'),
         url('callunaregular/Calluna-Regular-webfont.ttf') format('truetype'),
         url('callunaregular/Calluna-Regular-webfont.svg#callunaregular') format('svg');
    font-weight: normal;
    font-style: normal;

}

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

我认为这是一个简单的修复,但我不知道我做错了什么!

编辑:

<body style='background-color:white'>
<div align='center' style='position:absolute;left:500px;top:89px'> 
    <a id='title' href='home.html' > 
        <span style="font-family: callunaregular; font-size: 79px;">Open Mic Night</span>
    </a>

等同于将 font-family 设置为 Times。

【问题讨论】:

  • 问题出在你没有展示的东西上。 使用 Calluna Regular 的样式规则是什么?它们是否与您认为应该匹配的 HTML 匹配?查看浏览器调试器中的网络跟踪面板;字体是否被下载,您是否收到 HTTP 错误,还是什么?
  • 我曾经遇到过类似的问题。您是否尝试过检查您的 HTML &lt;link&gt; 标签以确保它们包含以下属性:rel="stylesheet"
  • 我的 CSS 中没有任何特别使用 Calluna 的内容。相反,我只是在某些范围内明确调用它。
  • @MaddyByahoo 你把这段 CSS 代码放在哪里了?您是否在 HTML 页面中正确包含了 CSS 文件?
  • 是的。 CSS 的其余部分显示良好。

标签: html css font-face


【解决方案1】:

也许这会导致问题?:

'callunaregular/Calluna-Regular-webfont.svg#bodonitownregular'

看到,在哈希之后?

【讨论】:

  • 很好,但我将其更改为 #callunaregular 但它没有做任何事情。
猜你喜欢
  • 2023-03-10
  • 2010-10-08
  • 2016-05-30
  • 1970-01-01
  • 2012-10-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-08-10
相关资源
最近更新 更多