第一个红色没有显示,为什么呢?

来源: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回答

好帮手慕糖

2020-07-01

同学你好,是指如下红色没有显示吗?

http://img.mukewang.com/climg/5efbf108095a437802800461.jpg

这是因为设置样式这里,少了一个f,应该是#f00,例:

http://img.mukewang.com/climg/5efbf1550925082703980161.jpg

如果我的回答帮助了你,欢迎采纳,祝学习愉快~

0
heixin_慕田峪7033080
h 修改后,为什么红色的上面会出现一段灰色的呢?怎么回事,
h020-07-01
共1条回复

好帮手慕糖

2020-07-01

同学你好,如下,这是第一个div元素的哦。div元素高度是150px,但是两个子元素并没有占据父级全部的高度,剩下的部分是灰色。

http://img.mukewang.com/climg/5efc21b0093f85a905060750.jpg

祝学习愉快~

0

0 学习 · 40143 问题

查看课程