python - Django- CSS 不适用于其他页面,例如标题标签
问题描述
我已将我的 css 文件链接到“main/static/css/style.css”中,并且我的页面位于“main/templates/main/pages.html”中。但是 CSS 不适用于某些页面,例如 h2 标签不采用样式。
base.html
{% load static %} <link rel="stylesheet" href="{% static 'css/style.css' %}">
隐私.html
{% extends 'main/base.html' %}
{% block content %}
<div class="main">
<h1><b>Privacy</b></h1>
<div style="height:35px" aria-hidden="true"></div>
<div class="text_para">
<h2 class="h2_privacy">Mission</h2>
<p>paragraph<p>
.......
样式.css
.main {
-ms-flex: 70%; /* IE10 */
flex: 70%;
background-color: white;
padding: 20px;
}
.text_para {
margin-right: 5%;
text-align: justify;
}
/*heading h2 for privacy page*/
.h2_privacy {
color: black;
font-family: 'Lucida Calligraphy', sans-serif;
}
解决方案
首先,您需要确保 CSS 加载正确(例如从浏览器开发工具的网络部分检查)。
其次,您需要确保元素在页面中并且具有正确的类匹配 CSS 文件。
如果您没有发现问题,请检查这两个并更新您的问题。
推荐阅读
- reactjs - useEffect 处于无限循环中
- c - 条目数为 6 或 10 时出错
- python - 如何减少python中两个音频文件之间的暂停?
- terraform - terraform kubernetes 提供者:命名空间目标
- kotlin - 我的 RELEASE 框架文件比 DEBUG 框架大
- angular9 - Angular 9 插件架构
- ios - SwiftUI - 在低于或等于 iOS 10 的部署目标上“使用未声明的类型 xxx”
- java - 本地主机上的 Spring Boot 应用程序:连接被拒绝
- java - HashMap 中的强引用
- multithreading - 在 Spring Batch 中使用自定义 TaskExecutor