我不想要一个固定页脚,我需要一个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