html - 如何将我的 div 放在其容器的底部?

给定以下 HTML:

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

我希望 #copyright 贴在 #container 的底部。我可以在不使用绝对定位的情况下实现这一点吗?

最佳答案

可能不会。

position:relative赋值给#container,然后position:absolute; bottom:0;#copyright.


#container {
    position: relative;
}
#copyright {
    position: absolute;
    bottom: 0;
}
<div id="container">
  <!-- Other elements here -->
  <div id="copyright">
    Copyright Foo web designs
  </div>
</div>

https://stackoverflow.com/questions/526035/

相关文章:

html - 为什么不在 HTML 中使用表格进行布局?

html - 从 IFrame 中删除边框

html - 有没有办法改变输入类型 ="date"格式?

javascript - 将 HTML Canvas 捕获为 gif/jpg/png/pdf?

html - 如何在 pre 标签中换行?

javascript - 如何检测 JavaScript 是否被禁用?

html - Zalgo 文本如何工作?

html - HTML中id和name属性的区别

html - 为输入类型 ="file"按钮设置样式

html - 默认情况下如何选择单选按钮?