第一个红色没有显示,为什么呢?
来源:2-41 编程练习
weixin_慕田峪7033080
2020-07-01 06:47:01
<!DOCTYPE html>
<html>
<head>
<title></title>
<style type="text/css">
div{
width: 200px;
height:150px;
background-color: #eee;
margin-top: 5px;
}
section{
width: 200px;
height: 30px;
margin-bottom: 5px;
background-color: #ff0;
}
/*此处写代码*/
div:empty{background-color:#00;}
section:empty{background-color:#abcdef;}
</style>
</head>
<body>
<div>
<section>one</section>
<section>two</section>
</div>
<div></div>
<div>
<section>three</section>
<section>four</section>
<section>five</section>
<section></section>
</div>
</body>
</html>
2回答
同学你好,是指如下红色没有显示吗?
这是因为设置样式这里,少了一个f,应该是#f00,例:
如果我的回答帮助了你,欢迎采纳,祝学习愉快~
好帮手慕糖
2020-07-01
同学你好,如下,这是第一个div元素的哦。div元素高度是150px,但是两个子元素并没有占据父级全部的高度,剩下的部分是灰色。
祝学习愉快~
相似问题