我的部分CSS内容为:
yarn build
但浏览器只加载一种字体。
@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");
}
。我做错了什么?
答案 0 :(得分:1)
@ font-face声明中的字体只有在页面上实际使用时才会加载。