首页 > 设计 > WEB开发 > 正文

网页不满屏时,如何让footer固定在底部,网页满屏时,随高度走

2019-11-02 18:29:10
字体:
来源:转载
供稿:网友
<!DOCTYPE HTML><html><head><meta charset="utf-8"><title>footer始终居于底部</title><style type="text/CSS">* { margin:0; padding:0; }body { font:14px/1.8 arial; }html, body, .wrap { height:100%; }.wrap {    height:auto;     min-height:100%;     _height:100%;     background:#CCC;     color:#fff;     font-size:18px;     text-align:center; }.main { padding-bottom:80px; }.footer {     position:relative;     height:80px;     line-height: 80px;     margin-top:-80px;     background:#333;     color:#fff;     font-size:16px;     text-align:center; }</style></head><body><div class="wrap">    <div class="main">        <h1>七七事变祭</h1>        <p>中华民族创辉煌,</p>         <p>倭寇菲佣心中慌。</p>         <p>为虎作伥傍老美,</p>         <p>东海南海滋事狂。</p>         <br />        <p>历史潮流不可挡,</p>         <p>中华儿女当自强。</p>         <p>警钟长鸣记国耻,</p>        <p>发展经济强国防。</p>        <br />        <p>七七事变77周年,勿忘国耻,振兴中华!!!</p>        <br />       </div></div><div class="footer">    <h1>页面高度不满,底部固定</h1></div></body></html>
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表