亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

CSS實例:讓頁腳保持在未滿屏頁面的底部

互聯(lián)網(wǎng)   發(fā)布時間:2008-10-17 19:20:27   作者:佚名   我要評論
  在內(nèi)容不超過一屏的情況下,當瀏覽器窗口變小那行頁腳文字會跟著向上浮動但還是保持在底部。   當內(nèi)容多出一屏時,他顯示在網(wǎng)頁的最下邊,而不是窗口的最下邊;測試了一下,還可以,在IE6、IE7、FF等都沒有問題!窗口縮小時也沒有問題!   首先是JS腳本:

  在內(nèi)容不超過一屏的情況下,當瀏覽器窗口變小那行頁腳文字會跟著向上浮動但還是保持在底部。
  當內(nèi)容多出一屏時,他顯示在網(wǎng)頁的最下邊,而不是窗口的最下邊;測試了一下,還可以,在IE6、IE7、FF等都沒有問題!窗口縮小時也沒有問題!
  首先是JS腳本:
function test(){
var infoHeight = document.getElementById("info").scrollHeight;
var bottomHeight = document.getElementById("bottom").scrollHeight;
var allHeight = document.documentElement.clientHeight;
var bottom = document.getElementById("bottom");
if((infoHeight bottomHeight) < allHeight){
bottom.style.position = "absolute";
bottom.style.bottom = "0";
}else{
bottom.style.position = "";
bottom.style.bottom = "";
}
setTimeout(function(){test();},10);
}
test();
  查看運行效果:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>CSS實例:讓頁腳保持在未滿屏頁面的底部</title>
<style>
*{ margin:0; padding:0}
#info{background:#33CCFF}
#bottom{background:#FFCC00;width:100%;}
</style>
</head>
<body>
<div id="info">
2<br />2<br />2<br />2<br />2<br /><br />2<br />2<br />2<br />2<br />2<br /><br />2<br />20000</div>
<div id="bottom">bottom</div>
<script language="JavaScript" type="text/javascript">
function test(){
var infoHeight = document.getElementById("info").scrollHeight;
var bottomHeight = document.getElementById("bottom").scrollHeight;
var allHeight = document.documentElement.clientHeight;

var bottom = document.getElementById("bottom");
if((infoHeight bottomHeight) < allHeight){
bottom.style.position = "absolute";
bottom.style.bottom = "0";
}else{
bottom.style.position = "";
bottom.style.bottom = "";
}
setTimeout(function(){test();},10);
}
test();
</script>
</body>
</html>

相關文章

  • css讓頁腳始終在底部不論頁面內(nèi)容多少

    讓頁腳始終在頁面底部,不論頁面內(nèi)容是多或者少頁腳始終在頁面底部,在某些情況下這些功能還是比較實用的,下面為大家介紹下幾種不錯的實現(xiàn)方法,大家可以參考下
    2013-09-06
  • 讓頁腳緊貼頁面底部的CSS代碼

    怎么使用Sticky Footer代碼 介紹 Google一下可以找到很多讓頁腳緊貼頁面底部的方法,我試過其中的很多,但他們總會在某些方面存在一些問題。之所以有這些問題,可
    2009-12-17
  • css讓頁腳保持在底部位置的四種方案

    本文主要介紹了css讓頁腳保持在底部位置的四種方案,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習
    2022-07-18

最新評論