我不想要一個固定頁腳,我需要一個STICKY頁腳。CSS Sticky Footer Margin
我的粘性頁腳首先運行良好,但當內容處於特定高度時,頁腳和頁面底部之間存在空白。
嘗試搞亂瀏覽器高度和內容div高度,你應該看到問題出在哪裏。
它在頁腳和頁面底部之間留下了一個尷尬的邊緣。
預先感謝您。
CSS代碼:
html, body {
height:100%;
margin:0;
}
body {
color:#FFF;
font:16px Tahoma, sans-serif;
text-align:center;
}
a {
text-decoration:none;
}
#wrapper {
height:100%;
margin:0 auto;
min-height:100%;
padding-bottom:-30px;
width:985px;
}
#content {
background:#F00;
height:950px;
}
#footer {
background:#000;
border-top:1px solid #00F0FF;
clear:both;
height:30px;
margin-top:-30px;
padding:5px 0;
width:100%;
}
#footer span {
color:#FFF;
font-size:16px;
padding-right:10px;
}
#push {
clear:both;
height:30px;
}
HTML代碼:
<!DOCTYPE HTML>
<html>
<head>
<title>Bad Footer</title>
<link rel="stylesheet" href="badfooter.css" type="text/css">
</head>
<body>
<div id="wrapper">
<div id="content">
<span>The footer leaves extra space at the bottom when you scroll all the way down. It starts out at the bottom for only the "Above the Fold" section (before scrolling it's at the bottom).</span>
</div>
<div id="push"></div>
</div>
<div id="footer">
<a href=""><span>About Us</span></a>
<span> | </span>
<a href=""><span>Contact Us</span></a>
<span> | </span>
<a href=""><span>Home</span></a>
</div>
</body>
設置位置固定不粘性頁腳...固定意味着它會始終保持底部(儘管滾動)。另一方面,粘腳是非常複雜的。如果正在滾動,則必須滾動底部才能看到頁腳,否則會停留在底部。 – Connor 2012-08-08 16:00:37
@Connor檢查答案中的更新 – Luis 2012-08-08 16:29:29
這似乎有竅門!謝謝一堆。 – Connor 2012-08-08 18:10:55