我正在尝试将“ box-left-mini”放在下面的div
前面。
<div class="box-left-mini">
this div is infront
<div style="background-image:url(/images/hotcampaigns/campaign-sample.png);height:100px;width:100px;">
this div is behind
</div>
</div>
box-left-mini
的CSS为:
.box-left-mini {
float:left;
background-image:url(website-content/hotcampaign.png);
width:292px;
height:141px;
}
您需要将z-index
添加到div,顶部div为正数,下方的div为负数
以一般方式回答问题:
一种可能是这样,
container can not come front to inner container. but try this below :
Css :
----------------------
.container { position:relative; }
.div1 { width:100px; height:100px; background:#9C3; position:absolute;
z-index:1000; left:50px; top:50px; }
.div2 { width:200px; height:200px; background:#900; }
HTMl :
-----------------------
<div class="container">
<div class="div1">
Div1 content here .........
</div>
<div class="div2">
Div2 contenet here .........
</div>
</div>
请确保不要隐藏溢出。如果将其设置为hidden,则将不允许您的新div(在上层元素被隐藏:hidden的父元素内)弹出或与其他div重叠。