Google 字体不显示
Google font not displaying
我正在尝试获取 Google 字体以从 css 加载到我的应用程序的 html 模板。无法让 "Upload schtuff" 使用 Bangers 字体。这是 base.html:
{% load static %}
<!doctype html>
<html>
<title>{% block title %}Upload Schtuff{% endblock %}</title>
<head>
<link href="//fonts.googleapis.com/css?family=Bangers&display=swap" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="{% static 'css/style.css' %}">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css">
</head>
<body>
<div>
<h1><a href="/">Upload schtuff </a></h1>
</div>
</body>
</html>
Here's the static/uploader/style.css:
'''
h1 a, h2 a
{
color: #714D91;
font-family: 'Bangers', cursive;
}
'''
I've also tried importing the font to the style sheet with
@import url('https://fonts.googleapis.com/css?family=Bangers&display=swap');
Also tried importing it to the .html file
<style>
@import url('https://fonts.googleapis.com/css?family=Bangers&display=swap');
</style>
它必须是我的 link href 行,对吧?
提前致谢!
好的,我开始工作了!这是我第一次添加多个 Css 文件...我在 settings.py 文件
中遗漏了这个
STATICFILES_DIRS = [os.path.join(BASE_DIR, "static")]
大声笑,感谢您成为一个良好的社区并在我解决自己的问题时支持我!
我正在尝试获取 Google 字体以从 css 加载到我的应用程序的 html 模板。无法让 "Upload schtuff" 使用 Bangers 字体。这是 base.html:
{% load static %}
<!doctype html>
<html>
<title>{% block title %}Upload Schtuff{% endblock %}</title>
<head>
<link href="//fonts.googleapis.com/css?family=Bangers&display=swap" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="{% static 'css/style.css' %}">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css">
</head>
<body>
<div>
<h1><a href="/">Upload schtuff </a></h1>
</div>
</body>
</html>
Here's the static/uploader/style.css:
'''
h1 a, h2 a
{
color: #714D91;
font-family: 'Bangers', cursive;
}
'''
I've also tried importing the font to the style sheet with
@import url('https://fonts.googleapis.com/css?family=Bangers&display=swap');
Also tried importing it to the .html file
<style>
@import url('https://fonts.googleapis.com/css?family=Bangers&display=swap');
</style>
它必须是我的 link href 行,对吧? 提前致谢!
好的,我开始工作了!这是我第一次添加多个 Css 文件...我在 settings.py 文件
中遗漏了这个STATICFILES_DIRS = [os.path.join(BASE_DIR, "static")]
大声笑,感谢您成为一个良好的社区并在我解决自己的问题时支持我!