0

在我的网站上获得粘性页脚是 CSS 代码

html, body {height:100%; }

#wrap {min-height: 100%;}

#main {overflow:auto; padding-bottom: 180px; }  /* must be same height as the footer */

#footer {position: relative;
margin-top: -180px; /* negative value of footer height */
min-height: 180px;
clear:both;} 

但是身体(我有一个bgcolor)和页脚之间有一个白色的差距......尝试了一切,有人遇到过类似的问题吗?

4

1 回答 1

0

您可以使用此 css 代码将页脚粘贴在底部

footer {
    position: fixed;
    bottom:0;
    min-height: 180px;
}

所以它会一直粘在底部。

于 2013-09-19T12:49:40.537 回答