使用css在另一个div的底部对齐div [英] align div in the bottom of another div using css

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

问题描述

我想在 DIV b 的底部对齐 DIV c ,而不是 DIV a

I want to align the DIV c in the bottom of the DIV b not DIV a

<div id="a">
   <div id="b">
        <div id="c">
              Div c
        </div>
   </div>
</div>


推荐答案



This should work:

#b {
  position: relative;
}

#c {
  position: absolute;
  bottom: 0px;
}

诀窍是 position:relative; 在父元素上。否则, #c 将会浮动到页面底部。

The trick is position: relative; on the parent element. Without that, #c will float away to the bottom of the page.

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

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