我正在使用django,我的<p>选择器正在工作,但<h1>没有工作。
我不明白为什么有些css在工作,而另一些则不起作用。
引导是按照什么顺序工作的?
它确实找到了style.css文件我的文本
元素工程
style.css
font-family: 'Wendy One', sans-serif;
font-family: 'Baloo', cursive;
font-family: 'Libre Baskerville', serif;
h1 {
color:yellow;
font-family: "Baloo", cursive;
}
p {
color: red;
font-family: 'Libre Baskerville',sans-serif;
}index.html
{% extends "base.html" %}
{% block content %}
<h1 class="text-center" >The Wish Fairy Foundation</h1>
<p> this should be the index of wishfairies.</p>
{% endblock %}base.html
{% load static %}
<!DOCTYPE html>
<html lang="en">
{% block title %}{% endblock %}
<head>
<link href="https://fonts.googleapis.com/css?family=Baloo|Libre+Baskerville|Wendy+One" rel="stylesheet">
<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">
<link rel="stylesheet" href="{% static 'css/style.css' %}">
</head>
{% block header %}
{% endblock %}
<body>
{% block sidebar %}
{% endblock %}
<div class="container">
{% block content %}
{% endblock %}
</div>
{% block footer %}
{% endblock %}
</div>
</div>
</div>
</body>
</html>发布于 2017-05-03 00:28:07
您的style.css文件无效。font-family行不包含在任何选择器中,因此它们违反了下一个规则(h1)
把字型系列线包起来。我假设您希望将它们封装在单独的元素中,这样它们就不会相互覆盖。
<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">
<style>
.wendy {
font-family: 'Wendy One', sans-serif;
}
.baloo {
font-family: 'Baloo', cursive;
}
.libre {
font-family: 'Libre Baskerville', serif;
}
h1 {
color:yellow;
font-family: "Baloo", cursive;
}
p {
color: red;
font-family: 'Libre Baskerville',sans-serif;
}
</style>
<link href="https://fonts.googleapis.com/css?family=Baloo|Libre+Baskerville|Wendy+One" rel="stylesheet">
<h1>h1</h1>
<p>paragraph</p>
https://stackoverflow.com/questions/43749132
复制相似问题