我试图在页面底部显示页脚。如果页面长于1个屏幕,我希望页脚仅在滚动到底部后才显示。因此,我不能使用“ position:fixed”,因为这样它将始终显示。
我正在尝试复制以下示例:http : //peterned.home.xs4all.nl/examples/csslayout1.html
但是,当我使用以下内容时,由于某种原因,页脚显示的是我的长页面的一半。
position: absolute; bottom:0
我既有短页也有长页,我希望它都位于两者的底部。
如何将页脚放在长页面的底部?
小提琴
我创建了这些小提琴来显示问题并测试代码。请在您的解决方案中发布一个有效的示例。
我的页脚CSS:
html,body {
margin:0;
padding:0;
height:100%; /* needed for container min-height */
}
.content {
position:relative; /* needed for footer positioning*/
margin:0 auto; /* center, not in IE5 */
height:auto !important; /* real browsers */
height:100%; /* IE6: treaded as min-height*/
min-height:100%; /* real browsers */
}
/* --- Footer --- */
.footerbar { position: absolute;
width: 100%;
bottom: 0;
color: white;
background-color: #202020;
font-size: 12px; }
a.nav-footer:link,
a.nav-footer:visited { color: white !important; }
a.nav-footer:hover,
a.nav-footer:focus { color: black !important;
background-color: #E7E7E7 !important; }
我建议使用“粘性页脚”方法。请参阅以下链接:
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句