2011-09-29 68 views
1

我有一个基于表格的html页面。我有一个UL菜单几个图表和几个表。我试图设计它,使它适合任何没有任何滚动条的屏幕。我的浏览器不尊重我为页面主表尝试的height = 100%。有什么想法吗?感谢提前:)适合各种屏幕的内容

回答

0

这里是我用来强制某些元素的高度使用Javascript/jQuery代码。

function resize(){ 
winH = 460; 
if (document.body && document.body.offsetWidth) { 
winH = document.body.offsetHeight; 
} 
if (document.compatMode=='CSS1Compat' && 
    document.documentElement && 
    document.documentElement.offsetWidth) { 
winH = document.documentElement.offsetHeight; 
} 
if (window.innerWidth && window.innerHeight) { 
winH = window.innerHeight; 
} 
$('#container').height(winH); 
} 
$(function(){ 
    resize(); 
    }); 
//the following code readjusts the element's height every time the browser window is altered. 
window.onresize = function() { 
    resize(); 
    } 
1

你将不适合的高度,只要你想,除了使用JavaScript或使用框架