【问题标题】:@font-face help it do not work@font-face 帮助它不起作用
【发布时间】:2018-05-27 14:22:09
【问题描述】:

我创建了这个测试文件

<h1> test <h1>

然后在 CSS3 中,我这样做了

@font-face {
font-family: 'hello';
src:url('/fonts/HelloStockholm-Alt.otf')
font-style: normal;
font-weight: 100;
} 

h1 {
font-family: hello;
font-weight: 100;
}

这是我下载的字体

https://www.dafont.com/de/hello-stockholm.font

希望你们中的一些人可以帮助我

【问题讨论】:

标签: html css fonts font-face


【解决方案1】:

你忘了在代码末尾写;

src:url('/fonts/HelloStockholm-Alt.otf');

更新

好的。我找到了正确的答案。我在本地制作了你的小项目,并下载了字体。这不是.otf 文件,而是.ttf 文件。 您只需将类型 .otf 更改为 .ttf

此外,如果您的 html 超出字体文件夹,则从字体源中删除 /。也许你在我下载的时候重命名了字体文件名称就像HelloStockholm-Regular

src:url('fonts/HelloStockholm-Regular.ttf');

最后你忘了关在这里h1 ;)

<h1> test </h1>

希望对您有所帮助。祝你好运!)

【讨论】:

  • 哦,对不起,我明白了,但这不是问题
  • 好的。我发现问题出在哪里;)
  • 如果答案有助于放弃投票并检查请喜欢“这个答案很有用”谢谢;)@Enes
【解决方案2】:

尝试删除字体前的“/”

@font-face {
font-family: 'hello';
src:url('fonts/HelloStockholm-Alt.otf');
font-style: normal;
font-weight: 100;
} 

h1 {
font-family: 'hello';
font-weight: 100;
}

【讨论】:

  • 我已经删除了字体文件夹,所以只有字体名称.otf
猜你喜欢
  • 1970-01-01
  • 2012-08-19
  • 2023-03-25
  • 2012-01-05
  • 1970-01-01
  • 1970-01-01
  • 2014-05-19
  • 2013-01-04
  • 2014-09-16
相关资源
最近更新 更多