麻烦老师检查一下
来源:4-7 编程练习
戴JAVA老师的小迷弟
2020-06-23 20:38:32
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>display属性</title>
<style type="text/css">
/*样式补充*/
*{margin: 0px;padding: 0px;}
li{list-style: none;}
.big{
background-color: rgb(194, 194, 194);
width: 200px;
margin: 20px auto;
text-align: center;
border: 1px gray solid;
}
h3{
border-bottom:1px gray solid;
}
.spe{
border-bottom: none;
}
ul{
background-color: white;
display: none;
}
.div1:hover .elec{
display: block;
}
.div2:hover .wash{
display: block;
}
.div3:hover .clothes{
display: block;
}
</style>
</head>
<body>
<div class="big">
<div class="div1">
<h3>家电</h3>
<ul class="elec">
<li>冰箱</li>
<li>洗衣机</li>
<li>空调</li>
</ul>
</div>
<div class="div2">
<h3>洗护</h3>
<ul class="wash">
<li>洗衣液</li>
<li>消毒液</li>
<li>柔顺剂</li>
</ul>
</div>
<div class="div3">
<h3 class="spe">衣物</h3>
<ul class="clothes">
<li>衬衫</li>
<li>裤子</li>
<li>卫衣</li>
</ul>
</div>
</div>
</body>
</html>
1回答
同学你好,效果是正确的,不过代码可以再简化一下:
祝学习愉快~