仅使用css,当body高度不足时,让footer始终底部显示。

来源:互联网 发布:js输入框不可编辑 编辑:程序博客网 时间:2024/05/16 07:57
<!DOCTYPE html><html><head>    <style>        *{            margin: 0;            padding: 0;        }        html,body{            height: 100%;        }        .wrap{            height: 100%;            background-color: blue;        }        .footer{            position: relative;            height: 40px;            margin-top: -40px;            background-color: red;        }    </style></head><body>    <div class="wrap">        <div class="header"></div>        <div class="center"></div>    </div>    <div class="footer"></div></body></html>
参考:1、CSS Sticky Footer: 完美的CSS绝对底部 http://paranimage.com/css-sticky-footer/

0 0
原创粉丝点击