gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-28 17:03:32 26 4
gpt4 key购买 nike

我目前正在尝试向我的网站添加自定义字体,但它似乎不起作用,我不是很擅长 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/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com