我必须将 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>
预览:
在这里查看 fiddle :http://jsfiddle.net/vLn32/
关于css - 将 div 对齐到底部,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12298861/