【问题标题】:Google Chrome wont show font (css3, html5) first time visiting. (only on refresh)谷歌浏览器第一次访问时不会显示字体(css3、html5)。 (仅在刷新时)
【发布时间】:2013-05-01 15:57:25
【问题描述】:

我有一个使用 CSS3 的网站

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

在我第一次访问该网站时(仅在 Google Chrome 中),我的代码中指定的字体不会显示,即使我按下链接转到另一个页面,它也不会正确更新字体。只有当我按 F5 键更新站点时,它才会呈现正确的字体。尝试了很多不同的修复方法,但没有成功(这就是为什么我有 2 个 @font-face ...)

我已经没有办法了,希望有人能在这个问题上帮助我。

【问题讨论】:

    标签: html google-chrome css font-face


    【解决方案1】:

    解决方案:

    我发现问题根本不在我的 CSS 文件中。

    事实证明,在我的 index.php 文件中,我在网页中使用的字体来自 googleapis.com 网站,如下所示:

    <link href='http://fonts.googleapis.com/css?family=Open+Sans+Condensed:300|Playfair+Display:400italic' rel='stylesheet' type='text/css' />
    

    在这个“CSS”文件中,字体 URL 没有封装在:' '

    我把 googleapis.com 生成的 CSS 文件的内容,放到我自己的 CSS 文件中,并封装了 URL。现在它工作正常!

    【讨论】:

      猜你喜欢
      • 2014-04-23
      • 1970-01-01
      • 1970-01-01
      • 2015-03-05
      • 2014-11-01
      • 2013-09-25
      • 2017-08-29
      • 1970-01-01
      • 2021-12-15
      相关资源
      最近更新 更多