Html 如何在css中重叠两个div?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16372000/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 08:07:42 来源:igfitidea点击:
how to overlap two div in css?
提问by zey
I have two div
likes ,
我有两个div
喜欢
<div class="imageDiv"></div>
<div class="imageDiv"></div>
and css
class ,
和css
班级,
.imageDiv
{
margin-left: 100px;
background: #fff;
display: block;
width: 345px;
height: 220px;
padding: 10px;
border-radius: 2px 2px 2px 2px;
-webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3), 0 0 40px rgba(0, 0, 0, 0.1) inset;
-moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3), 0 0 40px rgba(0, 0, 0, 0.1) inset;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3), 0 0 40px rgba(0, 0, 0, 0.1) inset;
}
You can see the result Here:)
你可以在这里看到结果:)
I want to overlap this two div
likes ,
我想重叠这两个div
喜欢,
回答by btevfik
add to second div bottomDiv
添加到第二个div bottomDiv
and add this to css.
并将其添加到 css 中。
.bottomDiv{
position:relative;
bottom:150px;
left:150px;
}
回答by Raab
See demo hereyou need to introduce an additiona calss for second div
看这里的演示你需要为第二个div引入一个额外的类
.overlap{
top: -30px;
position: relative;
left: 30px;
}