我也不知 Prop 体问题出在哪里,所以在标题里做了一个猜测。
基本上,我想做的是
<div id="header">Header</div>
<div id="content">Content</div><!-- Max screen height possible -->
<div id="footer">Footer</div>
在做了一个简单的计算之后,例如:window_height - header_height - footer_height
,它没有正确地适合屏幕。 (总共 3 个 div 高度大于窗口)
function adjustbody(){
var windowh = $(window).height();
var headerh = $("#header").height();
var footerh = $("#footer").height();
var contenth = windowh - headerh - footerh;
$("#content").css("min-height",contenth);
}
请在此处查看完整代码。 JSFiddle
我是否缺少一些要减去的高度?
最佳答案
重置您的 body/html 边距和填充。
body, html {
margin: 0px;
padding: 0px;
}
关于Jquery 没有获得正确的屏幕尺寸,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17722943/