我有一个html页面,这是基于表格。我有一个ul菜单,几张图表和几张表格。我正在尝试设计它,使其适合没有任何滚动条的任何屏幕。我的浏览器不支持我尝试用于页面主表的height=100%。有什么想法吗?提前感谢:)
发布于 2011-09-29 02:39:05
下面是我用来强制某些元素的高度的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();
}
发布于 2011-09-29 02:32:51
除了使用javascript或使用frameset外,您不能根据需要调整高度。
https://stackoverflow.com/questions/7591828
复制