Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/81.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在HTML中使用自定义字体?_Html - Fatal编程技术网

如何在HTML中使用自定义字体?

如何在HTML中使用自定义字体?,html,Html,我有一个从dafonts.com本地下载的.ttf文件,我想知道如何在我的网站上轻松使用它。它被称为永远的蝙蝠侠(链接:)。对新手有什么帮助吗 <html> <head> <style> body { height: 3000px; background: linear-gradient(180deg, #0fb8ad 0%, #7c0fb8 85%); } </style> </hea

我有一个从dafonts.com本地下载的.ttf文件,我想知道如何在我的网站上轻松使用它。它被称为永远的蝙蝠侠(链接:)。对新手有什么帮助吗

<html>
  <head>
    <style>
    body {
    height: 3000px;
    background: linear-gradient(180deg, #0fb8ad 0%, #7c0fb8 85%);
    }
    </style>
  </head>
<body>
  <center>
  <h1>Hello</h1>
  </center>
</body>
</html>

身体{
高度:3000px;
背景:线性梯度(180度,#0fb8ad 0%,#7c0fb8 85%);
}
你好

我想看到字体的工作只是我的标题(“你好”)。当前输出为默认字体。

您需要将其添加到样式中(示例):


没用。。。我应该保留括号吗?(很抱歉这么愚蠢,布兰德对编码一无所知)猜猜看,但我认为那是因为你的字体链接错了(在src中)。你可以在这里找到文档:你可以在你的电脑中使用本地链接,我只是写了一个语法示例
@font-face {
    font-family: myFirstFont;(choose the name for your font here)
    src:local("C:\Users\Website\fonts\Harlow_Solid_Italic.ttf");(put the link of font in your local computer)
}

body{
    font-family: myFirstFont; (write your font name here)
}