HTML/CSS 流体网格:如何将 div 叠加到另一个 div
HTML/CSS Fluid Grid: How to overlay div to another div
我真的很难找到答案。我试图让我的 div: 绝对,但它会破坏整个流体网格。我只想将 div 放在背景 div 之上。提前致谢!
CSS
#mannequin {
box-sizing: border-box;
position: absolute;
width: 60%;
padding: 0 12px;
margin: 0;
float: left;
overflow: hidden;
}
#products {
clear: both;
position: absolute;
margin-left: 0;
width: 100%;
display: block;
z-index: 10;
}
HTML
<div id="mannequin"><img src="http://tinypic.com/r/29596hh/9">
<div id="products"><img src="http://tinypic.com/r/2qw09lc/9">
</div>
</div>
请做一个Div位置:相对;和其他 div 使位置:绝对;
将 height:100%
定义为 #products
并将左上角定义为 0。
#mannequin {
box-sizing: border-box;
position: absolute;
width: 60%;
padding: 0 12px;
margin: 0;
float: left;
overflow: hidden;
}
#products {
clear: both;
position: absolute;
margin-left: 0;
width: 100%;
height: 100%;
display: block;
z-index: 10;
left:0;
top:0;
}
我真的很难找到答案。我试图让我的 div: 绝对,但它会破坏整个流体网格。我只想将 div 放在背景 div 之上。提前致谢!
CSS
#mannequin {
box-sizing: border-box;
position: absolute;
width: 60%;
padding: 0 12px;
margin: 0;
float: left;
overflow: hidden;
}
#products {
clear: both;
position: absolute;
margin-left: 0;
width: 100%;
display: block;
z-index: 10;
}
HTML
<div id="mannequin"><img src="http://tinypic.com/r/29596hh/9">
<div id="products"><img src="http://tinypic.com/r/2qw09lc/9">
</div>
</div>
请做一个Div位置:相对;和其他 div 使位置:绝对;
将 height:100%
定义为 #products
并将左上角定义为 0。
#mannequin {
box-sizing: border-box;
position: absolute;
width: 60%;
padding: 0 12px;
margin: 0;
float: left;
overflow: hidden;
}
#products {
clear: both;
position: absolute;
margin-left: 0;
width: 100%;
height: 100%;
display: block;
z-index: 10;
left:0;
top:0;
}