在主Div底部对齐Div [英] Align Div at bottom on main Div

查看:90
本文介绍了在主Div底部对齐Div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个div,一个在另一个,我想要小div在主div的底部对齐。

I have two divs, one inside the other and I would like the small div to be aligned at the buttom of the main div.

这里是我的代码到目前为止。目前,按钮位于主div的顶部,而我希望它位于底部。任何帮助将不胜感激。

Here's my code so far. Currently, the button is at the top of main div, instead I want it positioned at the bottom. Any help would be appreciated.

.vertical_banner {
    border: 1px solid #E9E3DD;
    float: left;
    height: 210px;
    margin: 2px;
    padding: 4px 2px 10px 10px;
    text-align: left;
    width: 117px;
}

#bottom_link{
 vertical-align: bottom;
}

这是我一直在尝试使用它,我仍然是CSS新手:)

Here's how I've been trying to use it, but as you can see I'm still new to CSS :)

<div class="vertical_banner">
    <div id="bottom_link">
         <input type="submit" value="Continue">
       </div>
</div>


推荐答案

像这样修改CSS:

.vertical_banner {
    border: 1px solid #E9E3DD;
    float: left;
    height: 210px;
    margin: 2px;
    padding: 4px 2px 10px 10px;
    text-align: left;
    width: 117px;
    position:relative;                 /* added */
}

#bottom_link{
   position:absolute;                  /* added */
   bottom:0;                           /* added */
   left:0;                             /* added */
}

这篇关于在主Div底部对齐Div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆