【问题标题】:Trying to implement a custom font on a website. Tried the follow code with no success尝试在网站上实现自定义字体。尝试了以下代码但没有成功
【发布时间】:2023-03-21 18:10:01
【问题描述】:

我正在尝试使用 VAGRouundedStd-Thin.otf 作为我的标题的字体。 我得到了字体,并使用 ftp 将它放在我的网站文件夹中。

之后,我将以下代码放入 css 文件中。

@font-face{
    font-family:"VAG Rounded W02 Thin";
    src:url("rimowaedition.com/VAGRoundedStd-Thin.otf") format("opentype"); 
}

h2 {
    font-family: "VAG Rounded W02 Thin" !important;
}

我很沮丧,并开始重视代码,但这并不重要。 关于如何让它使用字体的任何想法。

网站链接:http://rimowaedition.com/

【问题讨论】:

  • 即使你成功添加了你的字体,如果不做额外的工作,它很可能无法在其他浏览器/操作系统上运行。使用fontsquirrel.com/tools/webfont-generator 并上传您的otf 字体,它会将其转换为其他格式以实现跨浏览器兼容性。
  • 我认为问题出在字体文件的位置。您是否在控制台中遇到任何错误。
  • Fontsquirrel 对我不起作用,因为它是付费字体。他们只做免费字体。
  • 不久前有人问过类似的问题。在这里查看:stackoverflow.com/questions/26202569/…
  • 谢谢先生,我一定会通过的。

标签: html css fonts


【解决方案1】:

改成这个。

@font-face{
    font-family:"VAG Rounded W02 Thin";
    src:url("http://rimowaedition.com/VAGRoundedStd-Thin.otf") format("opentype"); 
}

希望这可行!

【讨论】:

  • 嗨,只是想知道我是盲人还是他们看起来一样。不想听起来粗鲁。我认为这一切都在我脑海中浮现。
  • 我更改了字体的位置。你刚刚有rimowaedition.com/VAGRoundedStd-Thin.otf,但你需要http://在前面,所以我把它改成了http://rimowaedition.com/VAGRoundedStd-Thin.otf
猜你喜欢
  • 2016-06-13
  • 2011-02-27
  • 1970-01-01
  • 2019-10-26
  • 2017-12-13
  • 2018-12-14
  • 2020-06-28
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多