国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發(fā) > CSS > 正文

css讓頁腳始終在底部不論頁面內容多少

2024-07-11 08:28:25
字體:
來源:轉載
供稿:網友
讓頁腳始終在頁面底部,不論頁面內容是多或者少頁腳始終在頁面底部。

方案一:

復制代碼
代碼如下:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<style type="text/css">
body,html {
margin: 0;
padding: 0;
height:100%;
}
#main {
position: relative;
min-height:100%;
background:#eee;
}
#content {
padding: 10px;
padding-bottom: 100px;
}
#footer {
position: absolute;
bottom: 0;
height: 100px;
width: 100%;
background:lightblue;
}
</style>
</head>
<body>
<div id="main">
<div id="content">
<script type="text/javascript">
for(var i=0; i<400; i++){
document.write(i+'<br/>');
}
</script>
</div>
<div id="footer">
Footer
</div>
</div>
</body>
</html>

方案二:

復制代碼
代碼如下:
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>css實現(xiàn)頁腳始終在最底部</title>
<style type="text/css">
* {padding: 0;margin: 0;}
html {*overflow: auto;}
body {_width: expression(this.parentNode.clientWidth);}
html,body {height: 100%;}
.section {min-height: 100%;_height: 100%;}
.footer {height: 60px;background: #000;margin-top: -60px;color: #FFF;}
</style>
</head>
<body>
<div class="section">
<script type="text/javascript">
for(var i=0; i<400; i++){
document.write(i+'<br/>');
}
</script>
</div>
<div class="footer">我是頁腳</div>
</body>
</html>

讓頁腳始終固定在屏幕底部:

復制代碼
代碼如下:
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<title></title>
<meta name="generator" content="editplus">
<meta name="author" content="Ariex">
<meta name="keywords" content="">
<meta name="description" content="">
<style type="text/css">
body{margin:0px;padding:0px;overflow:hidden;padding-top:22px;padding-bottom:22px;}
#header{background-color:blue;color:white;position:absolute;top:0px;left:0px;height:16px;width:100%;}
#content{background-color:yellow;width:100%;height:100%;overflow:auto}
#footer{background-color:green;color:white;width:100%;height:16px;position:absolute;bottom:0px;left:0px;}
</style>
<script language="javascript">
</script>
</head>
<body>
<div id="header">header</div>
<div id="content">
<script language="javascript">
for(i=0;i<1000;i++){
document.write(i+"
");
}
</script>
</div>
<div id="footer">footer</div>
</body>
</html>
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 嘉荫县| 万全县| 双鸭山市| 息烽县| 凤山市| 铁岭市| 通辽市| 汝州市| 兴化市| 简阳市| 汉源县| 崇文区| 红桥区| 遵义县| 兴仁县| 巫溪县| 孝感市| 陆丰市| 巴中市| 兴化市| 松潘县| 木兰县| 且末县| 信阳市| 阿瓦提县| 长垣县| 桂阳县| 平顶山市| 仁寿县| 临桂县| 石狮市| 临城县| 绩溪县| 随州市| 屏东县| 五河县| 汶川县| 汉阴县| 盱眙县| 太和县| 宁津县|