将div保持在另一个div的底部-CSS [英] Keep div at the bottom of another div - css
本文介绍了将div保持在另一个div的底部-CSS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望#copyright位于#outer的底部
I want the #copyright to be at the bottom of #outer
这里是#copyright的CSS
Here is the css for #copyright
#copyright{
position:relative; margin-bottom:0px; width:672px; height:20px; color:#FFF;
}
#yr{
margin:auto;
}
#f{ position:absolute; right:0px; text-align:center;
}
谢谢 吉恩
推荐答案
#copyright {
position: absolute;
bottom: 0;
}
#outer {
position: relative;
}
这将带来不幸的副作用,尽管#copyright
不再计入#outer
的高度,在您的示例中,#outer
的高度为0px.如果您使用固定的高度,则可以在#outer
处添加底部填充.
This will have the unfortunate side effect though that #copyright
does not count towards the height of #outer
anymore, in your example #outer
would be 0px high. You can add a bottom-padding to #outer
if you're working with fixed heights.
#copyright {
position: absolute;
bottom: 0;
height: 200px;
}
#outer {
position: relative;
padding-bottom: 200px;
}
这篇关于将div保持在另一个div的底部-CSS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文