我正在尝试将页脚保留在页面的底部。我尝试的第一种方法是,页脚将位于页面底部之上,背景将显示。这是与位置:静态; (如下面的图)页脚不在页面底部
我尝试的第二种方法是用绝对页脚。这将页脚放在没有足够内容滚动页面的底部,而是放在滚动页面上,当它加载并位于内容顶部时,它位于窗口的底部。它不是底部的页。
这里是我当前的代码:
<div id="container">
<div id="content">
<div id="slideshow"></div>
<div id="clear"></div>
<div id="boxes">
<div id="box">
<div id="boxheader"></div>
<div id="box1" class="box"></div>
</div>
<div id="box">
<div id="boxheader"></div>
<div id="box2" class="box"></div>
</div>
<div id="box">
<div id="boxheader"></div>
<div id="box3" class="box"></div>
</div>
</div>
<div id="clear"></div>
</div>
</div>
<div id="footer">Content</div>
这里是CSS
div#container{
position:relative;
margin: 4px;
}
#boxes{
width: 960px;
margin: 50px auto 0px auto;
}
#footer {
clear: both;
margin-top: 50px;
bottom: 0;
left: 0;
height: 200px;
background-color: #fff;
width: 100%;
}
请让我知道如果你需要任何额外的信息。
也许这将帮助:http://stackoverflow.com/questions/13103910/create-footer-element-located-beneath-the-screen – Hope4You
有什么使用'position:fixed'错误? –
@爆炸药丸,除非做一些“空气循环”,否则最终的脚部将覆盖部分的部位,没有滚动条可以隐藏隐藏的部分。 –