首页 > 解决方案 > 背景和其他 CSS 功能未在 Django 中显示

问题描述

base.html

{% load staticfiles %}

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>DPU</title>
    <link rel="stylesheet" type="text/css" href="{% static 'polls/style.css' %}"/>
    <style>
    h1 {color:red;}
    p {color:blue;}
    </style>
</head>

<hr>
<h1>Disease Polling Unit</h1>
<hr>
{% block main_content %}
{% endblock %}
</body>
</html>

在将其作为静态文件包含在 base.html 中后,背景、字体未显示。我做错了什么?

民意调查/静态/民意调查/style.css

li a {
    color:red;
    font-size:20px;
}

body {
    background:white url('images:pil1.jpg') no-repeat;
}

标签: cssdjango

解决方案


推荐阅读