css - 将 div 对齐到底部

标签 css html vertical-alignment

我必须将 div 附加到另一个 div 中,位置绝对(不能相对)到底部,代码看起来像

<div style="position:aboslute; top:100px; left:200px; height:500px">
    <div style="height:20px">Example 1</div>
    <div style="height:2px">Example 2</div>
</div>

解决方案?

最佳答案

给 parent 相对位置,给 child 绝对位置。

<div style="position:aboslute; top:100px; left:200px; height:500px">
    <div style="height:20px; position: absolute; bottom: 0;">Example 1</div>
    <div style="height:2px; position: absolute; bottom: 0;">Example 2</div>
</div>

预览:

Align divs to the bottom

在这里查看 fiddle :http://jsfiddle.net/vLn32/

关于css - 将 div 对齐到底部,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12298861/

相关文章:

html - 是否可以使用 bootstrap 错开列?

css - 如何垂直对齐 div 中的两个或多个(并排)元素?

html - 相对于包装器 div 在图像附近居中跨度

css - 如何在绝对元素内的文本前垂直对齐?

javascript - 如何在菜单部分滚动后线性显示背景颜色?

html - 如何居中对齐导航栏

javascript - extjs4 主题树面板

css - 为什么我的 div 没有脱离父 div?

Javascript - 单击时设置 div 显示 - 未定义类名

html - 如何使用 :hover 突出显示列表项的整个区域