网站尾部是居于页面最下面的代码
想要达到的目的是:当页面高度没有超过当前浏览器一屏的高度时,尾部是居于页面最下面。当页面高度超过当前浏览器一屏的高度时,尾部就随着页面的高度自动往下。
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>无标题文档</title> <style> *{margin:0;padding:0;} html,body{height:100%;color:#fff;} .main{background:#ccc;_height:100%;min-height:100%;} .main_m{padding-bottom:60px;background:#333;height:10px;} .footer{width:100px%;height:50px;background:black;margin-top:-50px;} </style> </head>
<body> <div class="main"> <div class="main_m">这里加内容,这里用了padding-bottom把footer的高度留出来</div> </div> <div class="footer">这是底部</div> </body>
</html>
辛苦整理@转载请注明:http://www.esw.net.cn/shownews.asp?id=310
更多关于网站建设推荐阅读:
可导致图层或图片抖动的JS特效代码分享
这就是经典的设计所能够带来的良好的体验
您知道服务器被访问的速度由哪些因素决定么?
|