让底部的div填充页面的剩余部分 [英] Let the bottom div fill the rest of the page

查看:101
本文介绍了让底部的div填充页面的剩余部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下结构:
image http:// images.devs-on.net/Image/4eludampmz3Ylfm6-Bereich.png

我不知道头部的高度,但我想要第二个容器以填充其余的高度。

I don't know the height of the head but I want the second container to fill the rest of the height.

我发现一些解决方案,当我现在的头部的大小,但我不。我想让上面的容器适合它的内容,而第二个容器正在填充窗口的其余部分。

I found some solutions when I would now the size of the head but I don't. I want that the upper container is fitting to its content while the second container is filling the rest of the window.

如何解决这个问题?

推荐答案

您可以使用JavaScript / jQuery

You can use JavaScript/jQuery

var topDivHeight = $("#topdiv").height(),
totalHeight = $(document).height();
$('#bottomDiv').height(totalHeight  - topDivHeight );

这篇关于让底部的div填充页面的剩余部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆