字体族是不能加引号的:
css
font-family: "Microsoft Yahei", serif;
多字体 fallback :
css
font-family: "Microsoft Yahei", "PingFang SC", serif;
自定义字体:
css
@font-face {
font-family: "IF";
src: url("./IndieFlower.ttf");
}
.custom-font {
font-family: IF;
}
网络字体:
css
@font-face {
font-family: "CF";
src: url("https://xxx/yy.ttf"); // 注意跨域的问题
}
.custom-font {
font-family: CF;
}
还有一种就是 iconfont 。