关于父元素撑开问题
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
<style type="text/css">
*{
margin: 0;
padding: 0;
}
.big{
width: 160px;
height: 186px;/*这里固定高度为186px,为什么鼠标移动上去,display隐藏的还可以通过hover出现了? 高度都定小了,为什么它还可以撑开啊?*/
position: fixed;
top: 50%;
left: 0;
margin-top:-93px;
font-family: "微软雅黑";
}
.a{
width: 160px;
height: auto;
background: #333;
border: 1px solid #FFF;
line-height: 60px;
text-align: center;
color:white;
}
.a ul{
width: 160px;
height: auto;
background: #FFF;
/*position: relative;
left: 160px;*/
}
.a ul li{
width: 160px;
height: 60px;
border-bottom: 1px dashed red;
color: red;
text-align: center;
}
.a ul{
display: none;
}
.a:hover ul{
display: block;
}
</style>
</head>
<body>
<div class="big">
<div class="a">
第一个标题
<ul>
<li>a二级标题</li>
<li>a二级标题</li>
<li>a二级标题</li>
</ul>
</div>
<div class="a">
第二个标题
<ul>
<li>a二级标题</li>
<li>a二级标题</li>
<li>a二级标题</li>
</ul>
</div>
<div class="a">
第三个标题
<ul>
<li>a二级标题</li>
<li>a二级标题</li>
<li>a二级标题</li>
</ul></div>
</div>
</body>
</html>125
收起
正在回答 回答被采纳积分+1
1回答
相似问题
登录后可查看更多问答,登录/注册
前端小白入门系列课程
- 参与学习 人
- 提交作业 11218 份
- 解答问题 36712 个
从一个不会编程的小白到一个老司机是需要过程的,首先得入门,学习基础知识,然后才能进阶,最后再到精通,本专题是你走进前端世界的不二选择!
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星