浏览器只加载一种字体

时间:2017-11-30 19:05:15

标签: css font-face

我的部分CSS内容为:

yarn build

但浏览器只加载一种字体。

  • 如果我只注释一种字体:只加载指定的字体。 (根据开发工具网络选项卡)
  • 如果定义了2个或更多字体:它总是@font-face { font-family: "Clarendon"; font-style: normal; font-weight: 300; src: url("fonts/Fontspring-DEMO-Clarendon-Light.otf") format("opentype"); } @font-face { font-family: "Clarendon"; font-style: normal; font-weight: 500; src: url("fonts/Fontspring-DEMO-Clarendon-Medium.otf") format("opentype"); } @font-face { font-family: "Clarendon"; font-style: normal; font-weight: 700; src: url("fonts/Fontspring-DEMO-Clarendon-Bold.otf") format("opentype"); } @font-face { font-family: "Clarendon"; font-style: normal; font-weight: 800; src: url("fonts/Fontspring-DEMO-Clarendon-Xbold.otf") format("opentype"); }
  • 我尝试过Chrome和Firefox。同样的行为。

我做错了什么?

1 个答案:

答案 0 :(得分:1)

@ font-face声明中的字体只有在页面上实际使用时才会加载。