div伸展100%页面高度,而不考虑内容 [英] div stretch 100% page height regardless of content

查看:101
本文介绍了div伸展100%页面高度,而不考虑内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在线(工作中)网站

基本上,我有我的所有网站的内容集中在一个div,它是一个指定的宽度和预期的高度为100%,不管内容的实际长度。我为 html body height:100%; c>和 #main ,但是div仍然短暂,如此页面 - 我不希望他们在 #main 的灰色框和屏幕底部之间有任何差距。这可能吗?如何?

Basically, I have all of my site's content centered within a div that is a specified width and an intended height of 100% regardless of the actual length of the content. I've specified height:100%; for html, body, and #main however the div still comes up short as seen on this page- I don't want their to be any gap between the #main's grey box and the bottom of the screen. Is this possible? How?

推荐答案

请参阅 jsfiddle

html, body {height: 100%;}
.container {min-height: 100%;}

这里讨论这个问题.....

discussing this over here too.....

正确的CSS,以确保body元素填充整个屏幕

这篇关于div伸展100%页面高度,而不考虑内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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