HTML,html教程
<html><head><title></title><style type="text/css">html, body{margin:0;padding:0;}.top{width:100%;height:36px;background-color: #ff0000;z-index:9999;}.bottom{width:100%;height: 36px;margin-top:52px;background-color: #0000ff;float:left;border-top:2px solid black;position:relative;bottom:0;}.centerHeight{width:100%;height:60px;background-color: #00ff00;float:left;margin-top:60px;border-top:2px solid black;}.topMargin{margin-top:36px;}.bottomMargin{border-bottom:2px solid black;}</style></head><body><div id="topDiv" class="top"><div><div id="centerDiv" class="centerHeight topMargin"><div><div id="centerDiv" class="centerHeight"><div><div id="centerDiv" class="centerHeight"><div><div id="centerDiv" class="centerHeight"><div><div id="centerDiv" class="centerHeight"><div><div id="centerDiv" class="centerHeight bottomMargin"><div><div id="buttomDiv" class="bottom"><div><script> var BodyHeight = document.body.scrollHeight; var ClientHeight = window.screen.height; if (BodyHeight <= ClientHeight) { document.getElementById("buttomDiv").style.position = 'absolute'; document.getElementById("buttomDiv").style.bottom = '0px'; document.getElementById("buttomDiv").style.width = '100%'; }</script></body></html>
↑ 這是在Firefox裡看到的效果,解析度:279*340↓ 下面這個是捲軸滾到最下面的效果
↑ 這個是在Firefox裡瀏覽,解析度為:285*528
這是JS更改的效果,可以看的出來擷取到網頁瀏覽的大小其實是擷取捲軸的大小,如果你擷取document.body.clientHeight,當解析度過低的時候就會擷取到0,就會導致錯誤。
這個是原來的樣式,這個就不解釋了。