html - 字体不工作

标签 html css fonts font-face

我使用下面的代码通过@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/

相关文章:

c# - 更改 WPF C# 中某些文本的颜色和字体

css - 基本 Casper 主题中的字体更改导致图标消失

javascript - 在里面用htmlhelpers动态创建div?

html - 如何在 anchor 标记中设置不同的 CSS 样式?

html - 将图像叠加到CSS中的div

html - 如何仅在一个边缘上禁用阴影?

javascript - .click 不适用于图形中的 anchor

html - 流体高度取决于 Drupal 主题中的内容

javascript - SVG 放大鼠标 - 数学模型

css - Linux FF 和 Windows FF 中的字体不一样