Html让页脚始终居于屏幕最下(css让页脚始终在底部不论页面内容多少)
2017-01-12 16:09
1131 查看
让页脚始终在页面底部,不论页面内容是多或者少页脚始终在页面底部,在某些情况下这些功能还是比较实用的,下面为大家介绍下几种不错的实现方法,大家可以参考下
原文地址http://www.jb51.net/css/102575.html
ps:
本人用的是方案二 ,之所以有地址还写(转载...)这篇文章 ,主要是为了防止出现员文章404 ,同时加深印象
原文地址http://www.jb51.net/css/102575.html
方案一:
<!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实现页脚始终在最底部</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>
ps:
本人用的是方案二 ,之所以有地址还写(转载...)这篇文章 ,主要是为了防止出现员文章404 ,同时加深印象
相关文章推荐
- css让页脚始终在底部不论页面内容多少
- css让页脚始终在底部不论页面内容多少
- CSS + DIV 让页脚始终保持在页面底部
- css 中 Sticky footers (让页脚紧贴页面底部的方法)
- Html-DW(4)div & css 设计head底部横条内容
- CSS + DIV 让页脚始终底部
- 无论页面内容多长,footer始终在页面底部
- 将页脚固定在页面底部的CSS实战
- JS获取网页高度及屏幕分辨率高度让DIV层始终在页面最底部
- CSS 关于让页面的高度达到电脑屏幕的底部
- CSS制作始终固定页面底部的DIV
- css实现让页面的footer始终位于底部
- CSS让脚部始终在页面底部
- js+css使DIV始终居于屏幕中间 左下 左上 右上 右下的代码集合
- CSS + DIV 让页脚始终底部
- 使用div+CSS将页脚始终控制在页面最下方的方法
- 如何保持页脚始终在页面底部
- 站长素材 代码预览页面 内容高度自适应 高度100% 实现页脚 底部显示
- html布局【内容小与一页时footer在页面底部,内容大与一页时footer在内容下面】
- HTML页面 css 怎么让内容自适应 出现拖动的滚动条