我同意杰里米,jQuery是不需要的。这是一个简单的CSS解决方案。
根本不需要使用z-index。删除导航栏上的绝对位置并将其左移浮动内容。 Can be seen here
CSS
#navigation { float:left;width:140px;height:300px; background-color:#E5450F;}
#navigation p {text-align:center;}
#content {height:300px;width:400px;background-color:#ddd;margin-bottom:10px;float:left;}
#footer {height:300px;width:auto;position:relative;z-index:0;background-color:#5F93AB;margin:;padding:0;text-align:center;}
#footer_b {height:300px;width:300px;background-color:#000;position:relative;z-index:0;color:#fff;}
HTML
<div id="content">
<p>Content</p>
<p style="font-size:0.8em;"> * Thanks for your help *</p>
</div>
<div id="navigation">
<p>Navigation</p>
<p style="font-size:0.8em;"> * Hide me under footer *</p>
<p style="font-size:0.8em;margin-top:230px;"> * Hide me *</p>
</div>
<div style="clear:both"></div>
<div id="footer">
<p>Footer</p>
</div>
<div id="footer_b">
<p>Footer_b</p>
</div>
你是什么意思将它隐藏在“页脚下”?如果它隐藏起来,它在哪里? – Jeremy 2010-09-24 15:36:01
@Jeremy我编辑了它。我希望它更有意义。 – Martin 2010-09-24 15:42:53
它有固定的原因吗?如果你只是把它漂浮在内容区旁边并清除它,它会在你点击页脚之前停止。 – 2010-09-24 15:45:44