问题是如何将特定字体应用于整个页面?我在下面的示例中做到了,它不起作用。仅当我将其应用于确切的标签时才起作用,例如:
<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>
答案 0 :(得分:1)
这可能是问题的原因
@font-face {
font-family: Palatino Linotype; src: url({% static "fonts/Arial.ttf" %});
}
尝试将其替换为以下
@font-face {
font-family: Palatino Linotype;
src: url({% static "fonts/Palatino.ttf" %});
}