将div放在父div的底部

时间:2015-08-07 08:28:10

标签: html css

代码:

<div id="divPopUp" style="border: 2px solid gray; padding: 20px; width: 700px; background: white; height: 450px; ">
     <h1 style="text-align:center">Handsets</h1>

             <table>
               some table content 
             </table>  
    <div class="footerButtons" style="display: block;">
        <div style="float: left;">
            <input type="button"/>
        </div>
        <div style="float: left; margin-left: 207px;">
         <input type="button"/> <input type="button"/>
        </div>
    </div>  
</div>

我需要将div "footerButtons"的div放到主div的底部。我该怎么办?

1 个答案:

答案 0 :(得分:1)

我已将position:relative添加到您的主div和position:absolute; bottom:10px添加到您的div footerButtons,以使其始终接近底部this
希望这有帮助!

<div id="divPopUp" style="border: 2px solid gray; padding: 20px; width: 700px; background: white; height: 450px; position:relative">
 <h1 style="text-align:center">Handsets</h1>

<table>some table content</table>
<div class="footerButtons" style="display: block; position:absolute; bottom:10px">
    <div style="float: left;">
        <input type="button" />
    </div>
    <div style="float: left; margin-left: 207px;">
        <input type="button" />
        <input type="button" />
    </div>
</div>