如何将我的div放在容器的底部? [英] How can I position my div at the bottom of its container?

查看:145
本文介绍了如何将我的div放在容器的底部?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

给定以下HTML:

<div id="container">
  <!-- Other elements here -->
  <div id="copyright">
    Copyright Foo web designs
  </div>
</div>

我想 #copyright 贴在 #container 的底部。

我可以实现这一点,而不使用绝对定位?如果float属性支持一个值'bottom',它似乎会做的伎俩,但不幸的是,它不。

Can I achieve this without using absolute positioning? If the float property supported a value of 'bottom' it seems that would do the trick, but unfortunately, it doesn't.

推荐答案

p>不太可能。

分配位置:相对到 #container ,然后 position:absolute; bottom:0; #copyright

#container {
    position: relative;
}
#copyright {
    position: absolute;
    bottom: 0;
}

这篇关于如何将我的div放在容器的底部?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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