1
我有一個基於表格的html頁面。我有一個UL菜單幾個圖表和幾個表。我試圖設計它,使它適合任何沒有任何滾動條的屏幕。我的瀏覽器不尊重我爲頁面主表嘗試的height = 100%。有什麼想法嗎?感謝提前:)適合各種屏幕的內容
我有一個基於表格的html頁面。我有一個UL菜單幾個圖表和幾個表。我試圖設計它,使它適合任何沒有任何滾動條的屏幕。我的瀏覽器不尊重我爲頁面主表嘗試的height = 100%。有什麼想法嗎?感謝提前:)適合各種屏幕的內容
這裏是我用來強制某些元素的高度使用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();
}
你將不適合的高度,只要你想,除了使用JavaScript或使用框架