html - 将自定义字体添加到网站 (HTML/CSS)

标签 html css

我目前正在尝试向我的网站添加自定义字体,但它似乎不起作用,我不是很擅长 atm 编程,但我的 friend 不在家,所以我只是想为他找到一个解决方案。如果使用 Calibri 作为字体,它目前可以工作,但任何自定义下载的字体都可以工作。他正在尝试使用 HelveticaNeue 字体。该字体位于 godaddy 的服务器文件夹中名为“fonts”的文件夹中。谢谢! :) 这是代码:

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





 h1{
    font-family: Calibri;
     letter-spacing: 6px;
     }

 p{
 font-family: Calibri;
 letter-spacing: 1px;
  }

最佳答案

添加一个简单的字体

@font-face {
font-family: 'Typogrotesk'; /*a name to be used later*/
src: url('TheURLToTheFontFile'); /*URL to font*/

} 然后像这样从 css、html 和 javascript 使用它

This is for css

 .example {
font-family: 'Typogrotesk';  
 }

The best way that i use for all my custom font is to generate the neccessary code for my font using this fontsquirrel

关于html - 将自定义字体添加到网站 (HTML/CSS),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51226399/

相关文章:

css - 动态 block 内的响应图像

jQuery/ajax 当前导航状态点击

javascript - 只有 anchor 链接在导航栏中工作

html - 定时动画

javascript - 如何制作具有交互功能的 HTML5 小部件?

html - 将 div 放置在 Canvas 顶部并始终位于全屏浏览器的右下角

javascript - 创建 html 按钮链接 - 不起作用

javascript - 如何防止 iframe 从父容器中窃取放置事件?

jquery - Bootstrap 进度条; 1%不可能?

jquery - css3 宽度过渡不适用于图像