css浮层:footer位置保持在底部
代码如下:
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name="keywords" content="http://www.baiduyo.com"/> <meta name="description" content="http://www.baiduyo.com" /> <title>如何让footer位置保持在底部</title> </head> <style> html, body { height: 100%; margin: 0; padding: 0; background:#ccc; } #container { min-height: 100%; height: auto !important; height: 100%; } #footer { position: relative; margin-top: -150px;/*等于footer的高度*/ height: 150px; clear:both; background: #06f; font-size:50px; font-weight:bold; text-align:center; } </style> <body> <div id="container"> <!--这里面添加其他布局--> </div> <div id="footer">footer</div> </body> </html>
THE END