先上代码:
点击,可预览效果
预期实现:
Content1与Content2两个DIV上下分布;
移入bk后,显示悬停的蓝色方块功能需保持不变。
问题:
Content1与Content2成了左右并排。
不会修改
postion
参数,并保持移入悬停功能不变。
请朋友们赐教,万分感谢!
先上代码:
点击,可预览效果
预期实现:
Content1与Content2两个DIV上下分布;
移入bk后,显示悬停的蓝色方块功能需保持不变。
问题:
Content1与Content2成了左右并排。
不会修改postion
参数,并保持移入悬停功能不变。
请朋友们赐教,万分感谢!
<html>
<body>
<style type="text/css">
.blue {
width: 200px;
height: 100px;
background: #09d;
margin: 10px;
display: none;
right:0px;
top:0px;
}
.bk {
width: 500px;
height: 350px;
background: grey;
display: flex;
-webkit-flex-direction: column;
flex-direction: column;
}
.bk:hover .blue {
display: block;
}
.content1 {
width: 100%;
background: #00faca;
display: block;
flex:1;
}
.content2 {
width: 100%;
height: 350px;
background: #00aaca;
display: block;
flex:1;
}
</style>
<div class="bk">
<div class="content1">
<p>Content2</p>
html如何让其中一个div浮在另一个div上面,html如何让其中一个div浮在另一个div上面。
</div>
<div class="content2">Content2
<div class="blue"></div>
</div>
</div>
</body>
</html>
感觉你布局这块比较混乱,建议使用flex就行了,看看这样是不是你想要的
2 回答861 阅读✓ 已解决
4 回答1.2k 阅读✓ 已解决
2 回答1.2k 阅读✓ 已解决
2 回答1k 阅读✓ 已解决
2 回答2.6k 阅读
1 回答1k 阅读✓ 已解决
2 回答892 阅读✓ 已解决
你把display:flex删掉