为什么我的Google字体在使用@font-face时无法加载?

3
我创建了字体并将其应用于页面的主体:

@font-face {
     font-family: 'Nosifer';
      src: url('https://fonts.googleapis.com/css?family=Nosifer');  
  }
 body { font-family: 'Nosifer' }
<body>
  This is text.
</body>

然而,Nosifer字体不可见。我做错了什么吗?
fiddle链接:http://jsfiddle.net/9mr7973y/
2个回答

5

Chrome在控制台中给出以下警告:

无法解码下载的字体:https://fonts.googleapis.com/css?family=Nosifer

OTS解析错误:无效的版本标记

Google Fonts实施指南不包括使用@font-face。如果要通过CSS导入它们,则建议使用@import

@import url('https://fonts.googleapis.com/css?family=Nosifer');

谢谢。本问题旨在寻找此问题的解决方案:https://stackoverflow.com/questions/46764887/how-to-load-fonts-automatically-on-the-website?noredirect=1#comment80475104_46764887,如果字体是告诉浏览器加载字体的方式。 - Yoda

0

add this in html header

<link href="https://fonts.googleapis.com/css?family=Nosifer" rel="stylesheet">

并应用字体

font-family: 'Nosifer', cursive;

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接