我試圖讓頁腳堅持到我的網頁的底部,但它只浮動一半。我看了幾個例子,我不知道我做錯了什麼。任何援助將不勝感激。我的簡化代碼如下所示。網站頁腳不會堅持頁面的底部
<html>
<head>
</head>
<body>
<div id = "wrapper">
<!--Wrapper div for the main content-->
</div>
<!--Footer container-->
<div class="footer">
</div>
</body>
</html>
--CSS--
body
{
height: 100%;
margin: 0;
padding:0;
background-color: #1A1F2B;
min-width: 960px;
}
#wrapper{
min-height: 100%;
}
.footer{
position: relative;
margin-top: -150px; /* negative value of footer height */
height: 150px;
clear:both;
display: block;
background-color: #232A3B;
}
更改位置:相對;定位:固定;因爲它堅持到底部。 –