以下是我的 homepage.html 是家庭应用程序
{% extends "base.html" %}
{% load static %}
<link rel = "stylesheet" href = "{% static 'css/home.css' %}" > #reference to stylesheet in the home app static directory
{% block body %}
<h1>I am homepage</h1>
{% endblock %}
我在项目根文件夹中的base.html如下
<!DOCTYPE html>
<html>
<head>
<link rel = "stylesheet" href = "{% static 'base.css' %}" > #stylesheet in root folder
</head>
<body>
{% block content %}
{% endblock %}
</body>
</html>
但是在这里,homepage.html 中的 home.css 不起作用,因为 extend 上的 base.html 在 home.css 进入 head 部分之前关闭了 head。
有什么办法可以将 CSS 添加到标题中
谢谢