在CSS中创建字体

问题描述 投票:0回答:1

我为我的网站添加了字体系列文件。

@font-face {
   font-family: 'FormulaCondesedLight';
   src: url("./fonts/SFProDisplay.otf");
}

h1 {
  font-family: 'FormulaCondesedLight';
  color:red;
}

即使我添加了上面的代码,也没有应用字体系列。可能是什么问题?演示https://codesandbox.io/s/floral-bash-byld7?file=/src/styles.css

html css
1个回答
-2
投票

请检查src的路径以获取正确的命名:

@font-face {
  font-family: "FormulaCondesedLight";
  src: url("./fonts/FormulaCondensed-Light.otf");
}
© www.soinside.com 2019 - 2024. All rights reserved.