我使用下面的代码通过@font-face 语句加载字体。字体在我的目录 yoo 中,但它不起作用:
@font-face {
font-family: 'irseri’;
src: url('irseri.ttf') format('truetype');
}
.about{
text-align: left;
font-size: 18px;
font-weight: bold;
font-family:irseri ;
color: #9f9f9f;
margin-top: 10px;
}
这是我的 html 代码:
<!DOCTYPE html>
<html>
<head lang="en">
<link rel="stylesheet" href="style.css" type="text/css">
<meta charset="UTF-8">
<title>Mehdi page</title>
</head>
<body>
<div class="content">
<div class="text"><div class="image"></div>Some Title</div>
<div class="about">Some Text<div>
</div>
</body>
</html>
最佳答案
尝试这段代码并使字体文件夹正确。检查 irseri.ttf 字体是否在文件夹中,它可能喜欢 src: url('../fonts/irseri.ttf') format('truetype');
@font-face {
font-family: 'irseri';
src: url('../irseri.ttf') format('truetype');
}
关于html - 字体不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27687089/