2012-04-05 15 views
0

3つの子divを親のボトムに合わせたいと思っています。マージントップで試してみましたが、ホールのものを動かします。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

#child divに3番目の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

スタイル親のdiv position: relative;として子のdivためposition: absolute; bottom: 0;を使用しています。

+0

子供divが消える.. – Ben

関連する問題