[英]New To HTML & CSS | How Can I Add A Custom Font From My Laptop?
I'm new to CSS and i'm not sure how to add a custom font.我是 CSS 的新手,我不确定如何添加自定义字体。 I've tried searching everywhere on Stackflow and cannot find an answer.
我试过在 Stackflow 上到处搜索,但找不到答案。
@font-face{
font-family: "Athelas";
src: url('Athelas.ttf') format("truetype");
font-style: normal;
font-weight: normal;
}
body{
background: rgb(2,0,36);
background: linear-gradient(137deg, rgba(2,0,36,1) 0%, rgba(9,9,121,1) 35%, rgba(0,212,255,1) 100%);
background-attachment: fixed;
}
.center{
text-align: center;
font-size: 90px;
font-family: "Athelas";
}
Note: I'm Used To Developing In LUA Via Roblox And I'm New To Stackflow注意:我习惯于通过 Roblox 在 LUA 中进行开发,而且我是 Stackflow 的新手
You can specify the src to be local, for example: src: local("Ubuntu Light")
您可以将 src 指定为本地,例如:
src: local("Ubuntu Light")
If the local() function is provided, specifying a font name to look for on the user's computer, and the user agent finds a match, that local font is used.
如果提供了 local() function,指定要在用户计算机上查找的字体名称,并且用户代理找到匹配项,则使用该本地字体。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.