HTML / CSS流体网格:如何将div叠加到另一个div

时间:2016-05-03 09:29:59

标签: html css css3 web fluid-layout

我真的很难研究答案。我试图制作我的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>

2 个答案:

答案 0 :(得分:0)

请做一个Div职位:亲属;和其他div做位置:绝对;

答案 1 :(得分:0)

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;
}