2011-08-16 47 views

回答

0

沒辦法,因爲ASP.NET是一個服務器端腳本語言 - 和服務器不顯示任何頁面的屏幕,也因此沒有「屏幕尺寸」。

0

Matten是正確的,當然,這個問題與ASP.NET無關 - 它更像一個HTML/CSS問題,並不難研究。但是,這裏有一些基本知識:

通常,我將所有或大部分頁面放入具有一定寬度的DIV中 - 從50-90%的任何位置,具體取決於看起來不錯。這需要照顧寬度

在標題之後,我的其他頁面往往需要滾動而不會丟失標題,這樣所有的DIV都會在「scrollcontainer」中進行,然後我會包含這個javascript(我忘記了幾個月後我偷走了它或幾年前):

function resizeScrollContainer() { 
    var windowHeight; 
    var newHeight; 
    if (typeof window.innerWidth != 'undefined') { 
     windowHeight = window.innerHeight; 
    } 
    else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0) { 
     windowHeight = document.documentElement.clientHeight; 
    } 
    else { 
     windowHeight = document.getElementsByTagName('body')[0].clientHeight; 
    }; 

    newHeight = windowHeight - document.getElementById("scrollContainer").scrollTop - 135; 
    if (newHeight > 200) { 
     document.getElementById("scrollContainer").style.height = newHeight + "px";    
    } 
    else { 
     document.getElementById("scrollContainer").style.height = 200; 
    } 
} 
window.onresize = resizeScrollContainer; 
window.onload = resizeScrollContainer; 

該javascript保持主DIV的高度僅略低於瀏覽器的高度。這需要照顧高度

我希望這有助於!

相關問題