为什么我的字体不像Google字体上出现?

发布于 2025-01-20 23:51:36 字数 991 浏览 4 评论 0原文

我从 google fonts 获得了两种字体,并将它们应用到我的 CSS 文档中。然后我将它们添加到我的文档中,但由于某种原因它们没有像网站上显示的那样显示。

这是我的代码:

@import url('https://fonts.googleapis.com/css2?family=League+Spartan:wght@500&family=Libre+Baskerville&display=swap');

h1, h2, h3, h4, h5, h6 {
  font-family: 'League Spartan', sans-serif;
}

p {
  font-family: 'Libre Baskerville', serif;
}

这是两种字体的链接:

https://fonts.google.com/specimen/Libre+Baskerville?query=libre+bas&preview.text=Lorem%20Ipsum&preview.text_type=custom

https://fonts.google.com/specimen/League+Spartan?query=league+&preview.text=Lorem%20Ipsum&preview.text_type=custom

I have gotten two fonts from google fonts, and have applied them to my CSS document. Then I added them to my document, but they don't show up as what appeared on the website for some reason.

Here is my code:

@import url('https://fonts.googleapis.com/css2?family=League+Spartan:wght@500&family=Libre+Baskerville&display=swap');

h1, h2, h3, h4, h5, h6 {
  font-family: 'League Spartan', sans-serif;
}

p {
  font-family: 'Libre Baskerville', serif;
}

Here is the link to both fonts:

https://fonts.google.com/specimen/Libre+Baskerville?query=libre+bas&preview.text=Lorem%20Ipsum&preview.text_type=custom

https://fonts.google.com/specimen/League+Spartan?query=league+&preview.text=Lorem%20Ipsum&preview.text_type=custom

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

清眉祭 2025-01-27 23:51:36

我找到了它是什么:
@Import必须在其他CSS之前处于样式表的顶部。

I have found what it is:
The @import has to be at the top of the stylesheet, before any other css.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文