自定义字体不导入

发布于 2025-02-12 09:48:16 字数 1133 浏览 1 评论 0原文

字体CSS导入似乎都没有用... 我以为也许是因为我没有使用XAMPP,但这似乎并不重要……我不明白。

<style>
@font-face{
    font-family: "ogrejuice";
    src: url('ogrejuice.ttf'),
    url('ogrejuice.eot'); /* IE */
}
</style>

尝试2

<style>
@font-face{
    <!-- font-family: "ogrejuice"; -->
    src: url('ogrejuice.woff2'),
    src: local('ogrejuice.woff2'), 
    <!-- url('ogrejuice.eot'); /* IE */ -->
}
</style>

尝试3

<style>
@font-face{
    <!-- font-family: "ogrejuice"; -->
    src: url('ogrejuice.woff2'),
    src: local('ogrejuice.woff2'), 
    <!-- url('ogrejuice.eot'); /* IE */ -->
}
@font-face {
  font-family: "ogrejuice";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("../ogrejuice.eot");
  src: url("../ogrejuice.eot?#iefix") format("ie9-skip-eot"),
  url("../ogrejuice.woff2") format("woff2"),
  url("..ogrejuice.woff") format("woff");
}
</style>

尝试4

<style>
@font-face {
  font-family: myFirstFont;
  src: url(ogrejuice.woff);
}
</style>

none of the font CSS import seems to work...
I thought maybe it was because I wasn't using xampp, but it doesn't seem to matter... still doesn't work, I don't understand.

<style>
@font-face{
    font-family: "ogrejuice";
    src: url('ogrejuice.ttf'),
    url('ogrejuice.eot'); /* IE */
}
</style>

attempt 2

<style>
@font-face{
    <!-- font-family: "ogrejuice"; -->
    src: url('ogrejuice.woff2'),
    src: local('ogrejuice.woff2'), 
    <!-- url('ogrejuice.eot'); /* IE */ -->
}
</style>

attempt 3

<style>
@font-face{
    <!-- font-family: "ogrejuice"; -->
    src: url('ogrejuice.woff2'),
    src: local('ogrejuice.woff2'), 
    <!-- url('ogrejuice.eot'); /* IE */ -->
}
@font-face {
  font-family: "ogrejuice";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("../ogrejuice.eot");
  src: url("../ogrejuice.eot?#iefix") format("ie9-skip-eot"),
  url("../ogrejuice.woff2") format("woff2"),
  url("..ogrejuice.woff") format("woff");
}
</style>

attempt 4

<style>
@font-face {
  font-family: myFirstFont;
  src: url(ogrejuice.woff);
}
</style>

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

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

发布评论

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

评论(1

淡忘如思 2025-02-19 09:48:16

好吧,所以。第一次使用自定义字体用户...当您设置字体时。这并不意味着您的页面会使用它...考虑上述

<style>
@font-face {
  font-family: myFirstFont;
  src: url(aesymatt.ttf);
}
body{
    font-family: myFirstFont;
}
</style>

代码对我来说很好。不知何故,设置字体脸实际上没有做任何事情,除了使字体可用吗?绝对不会想到这一点。除了特定的情况之外,我通常不会在项目的CSS中使用 @符号,因此直到现在我还没有对其进行任何关注。

ok so. For all first time custom font users out there... when you set the font.. That doesn't mean your page will use it... Consider the fallowing

<style>
@font-face {
  font-family: myFirstFont;
  src: url(aesymatt.ttf);
}
body{
    font-family: myFirstFont;
}
</style>

The above code works fine for me. Somehow, setting the font-face doesn't actually do anything except make the font available, I guess? Definitely would not have thought of that. I don't normally use the @ symbol in the CSS of my projects except for specific cases like break points, so I haven't paid any attention to it until now.

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