下面显示的基于类视图的应用程序的扩展html没有从html中提到的静态文件中获取css。 请帮忙知道如何为这个扩展块实现css。
HTML文件:
{% extends "base_template.html" %}
{%block css%}
{% load static %}
<link href="{%static 'css/custom.css' %}" rel="stylesheet">
{%endblock%}
{% block content %}
<h2>Dynamic content</h2>
<p>You have visited this page {{ num_visits }}{% if num_visits == 1 %} time{% else %} times{% endif %}.</p>
<div class="btnlayout" style="float: left;padding: 10px;">
<li><form action="/ekmmsc/treedump/printx" method="get">
<input type="text" value="8" name="mytextbox" size="1"/>
<input type="submit" class="btn" value="Click" name="mybtn">
</form></li>
<li><form action="/ekmmsc/treedump/Tree70" method="get">
<input type="submit" class="btn" value="Tree70" name="mybtn1">
</form></li>
<li><form action="/ekmmsc/treedump/UserID" method="get">
<input type="submit" class="btn" value="UserID" name="mybtn2">
</form></li>
<li> <form action="/ekmmsc/treedump/TG_Dump" method="get">
<input type="submit" class="btn" value="TG_Dump" name="mybtn3">
</form></li>
</div>
{% endblock %}
Custom.css
h1, h2, h3, h4, h5, h6 {
color: black;
}
.btnlayout li form{
display: inline-block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
width: 80px;
}
.btnlayout li {
float: left;
border-right:1px solid #bbb;
border-left:1px solid #bbb;
}
base_template.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>EKMMSC</title>
{% load static %}
<link href="{%static 'css/style1.css' %}" rel="stylesheet">
{% block css %}{% endblock %}
</head>
我需要将内联显示的表单元素显示为列表。
** Custom.css出现在/ static / css / * **中 并且静态文件正在加载,因为我通过放置图像交叉检查但css文件没有加载。