问答和手记的CSS样式没有生效
来源:5-3 模板的继承之包含语法
慕圣1031945
2022-05-14 09:51:23
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>首页-慕课网</title>
<style type="text/css">
.container {
width: 600px;
height: 500px;
margin: 0 auto;
}
header {
background: aqua;
}
article {
background: azure;
height: 500px;
}
article.left{
background-color: blue;
width: 60%;
float: left;
}
article.right{
background-color: rebeccapurple;
width: 40%;
float: left;
}
footer {
background-color: coral;
}
</style>
</head>
<body>
<div class="container">
<header>
{% block header %}
页面头部[慕课网首页
免费课程
实战课程
金职位
专栏
猿问
手记]
{% endblock %}
</header>
<article>
{% block content %}
<p>课程内容</p>
{% endblock %}
</article>
<footer>页面底部</footer>
</div>
</body>
</html>
{% extends 'base.html' %}
{% block content %}
<aside class="left">
左侧内容区域--问答
</aside>
<aside class="right">
右侧内容区域--问答
{% include 'sidebar.html' %}
</aside>
{% endblock%}1回答
好帮手慕燕燕
2022-05-14
同学,你好!article标签和class属性之间要有空格,同学少写了空格,因此样式没有生效

祝:学习愉快!
相似问题