2012-04-05 90 views
0

我想将3个子div对齐到父母的底部,我尝试使用margin-top但它移动了洞的东西。如何将div对齐到另一个div的底部

<div style="border:1px solid red;width:200px;height:100px;"> 


<div style="height:72px;width:96px;margin:9px;"> 

<div style="background-color:red;height:47px;text-align:center;">This div</div> 

</div> 


</div> 

回答

0

您可以将第三个div添加到#child div中。

<div id="parent"> 
    <div id="child"> 
     content 
    </div> 
</div> 

#parent { 
    position: relative; 
    width: 200px; 
    border: 1px solid red; 
    height: 100px; 
} 
#child { 
    position: absolute; 
    bottom: 0; 
    left: 0; 
    width: 100%; 
    height: 50px; 
    background-color: red; 
} 
0

风格的父DIVposition: relative;和使用position: absolute; bottom: 0;孩子DIV

+0

小孩div消失.. – Ben 2012-04-05 05:53:21