填充剩余垂直空间 [英] Filling remaining vertical space
问题描述
重新设计我的网站,在我的CSS我有一个高度的div:200px;然后在它下面的一个图像的高度:532px;那么最后一个div的高度:100%;
Redesigning my website, in my CSS I have a div of height: 200px; then an image under it with a height: 532px; then lastly a div of height: 100%;.
最后一个div不填充页面的其余部分,有什么我做错了吗?
The last div is not filling the rest of the page, is there something I'm doing wrong?
PS - 所有div都在一个容器中。所有包含div的高度都为100%;
P.S. - All divs are in a container. All containing divs have height: 100%;
我已经更改了它,所以我不再需要这个。 >
推荐答案
首先,需要将html和body的高度设置为100%。
然后,如果你想用该div覆盖页面的其余部分,你应该这样做:
First, you need to set the height of html and body to 100%. Then if you want to cover the rest of the page with that div you should do something like:
div{
height: -moz-calc(100% - 732px); //732 = 200 + 532
height: -webkit-calc(100% - 732px);
height: calc(100% - 732px);
}
希望这会有帮助....
Hope this will help....
这篇关于填充剩余垂直空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!