html - 在 HTML 页面中添加额外的字体

标签 html css django

问题是如何将特定字体应用于整个页面?我在下面的例子中做了它,但它不起作用。只有当我将它应用到确切的标签时它才有效,如下所示:

<p style="font-family: Palatino Linotype; src: url({% static "fonts/Palatino.ttf" %})">Description-{{ current_boat.boat_description }}</p>
        </div>
{%  load bootstrap4 %}
{% load static %}
{% load staticfiles %}
{%  load thumbnail %}

<html lang="en">
<head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
    <title>Boat pdf</title>

     <style type="text/css">

    @font-face   {
        font-family: Palatino Linotype; src: url({% static "fonts/Arial.ttf" %});
    }
    body {
        font-family: "Palatino Linotype", Arial, sans-serif;
        color: #333333;
    }

    </style>
</head>
<body>


            <p style="font-family: Palatino Linotype; src: url({% static "fonts/Palatino.ttf" %})">Description-{{ current_boat.boat_description }}</p>
        </div>

        <div class="row">
            {% for instance in current_boat.images %}


                <a href=" {{ instance.boat_photo.url}}"> <img class="  ml-3" src="{% thumbnail instance.boat_photo "default"  %}"></a>

            {% endfor %}

        </div>


</body>
</html>




最佳答案

这可能是问题的原因

@font-face   {
    font-family: Palatino Linotype; src: url({% static "fonts/Arial.ttf" %});
}

尝试用下面的替换它

@font-face   {
    font-family: Palatino Linotype; 
    src: url({% static "fonts/Palatino.ttf" %});
}

关于html - 在 HTML 页面中添加额外的字体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55878936/

相关文章:

Django 多事件项目轮播

javascript - 隐藏一个 css 制作的下拉菜单

php - 文件上传验证

javascript - .htaccess 受密码保护的网站在 Ipad 上重新加载每个页面时都需要密码

html - 将 div 的右侧设为箭头

javascript - Bootstrap 文本框 Dropbox 搜索

css - 是否可以在有多个类值的地方使用 css 通配符类选择器?

python - 引用Django模型方法中的ManyToMany字段

python - 中间件筛选器页面的安全问题

HTML & CSS : My form causes all other elements in it's parent container to become mis-aligned