美文网首页
CSS Sticky Footer

CSS Sticky Footer

作者: 被遗忘的传说 | 来源:发表于2017-02-12 22:27 被阅读0次

    HTML

    <div id="wrap">
        <div id="main" class="clearfix">
            <div id="content">
            </div>
            <div id="side">
            </div>
        </div>
    </div>
    <div id="footer">
    </div>
    

    CSS

    .clearfix:after {content: ".";
        display: block;
        height: 0;
        clear: both;
        visibility: hidden;}
    .clearfix {display: inline-block;}
    /* Hides from IE-mac \*/
    * html .clearfix { height: 1%;}
    .clearfix {display: block;}
    /* End hide from IE-mac */
    html, body, #wrap {height: 100%;}
    body > #wrap {height: auto; min-height: 100%;}
    #main {padding-bottom: 150px;}  /* 必须使用和footer相同的高度 */
    #footer {position: relative;
        margin-top: -150px; /* footer高度的负值 */
        height: 150px;
        clear:both;}
    

    相关文章

      网友评论

          本文标题:CSS Sticky Footer

          本文链接:https://www.haomeiwen.com/subject/mzfzittx.html