我想知道如何让页脚在没有足够内容时留在底部。如何让页脚留在页面底部
如果我用这个为CSS position:absolute; bottom:0;
的问题是,如果有足够多的内容更页脚漂浮,覆盖的内容。
感谢。
我想知道如何让页脚在没有足够内容时留在底部。如何让页脚留在页面底部
如果我用这个为CSS position:absolute; bottom:0;
的问题是,如果有足够多的内容更页脚漂浮,覆盖的内容。
感谢。
您需要定义position: fixed; bottom: 0; width: 100%;
但事情是我不希望页脚被修复。我只是希望它被粘在页面的底部。 谢谢。你定义了宽度的 – ipman
吗?位置:绝对 –
你的结构需要看起来像这样:
<body>
<section id="wrap><!-- This has header, etc --></section>
<footer></footer>
</body>
然后CSS(其中50像素是您的页脚的高度,只是更换):
html, body { height: 100%; }
#wrap {
min-height: 100%;
padding-bottom: 50px;
}
footer {
height: 50px;
margin-top: -50px;
}
http://www.cssstickyfooter.com/应该是你要找的。
这是你在找什么? http://ryanfait.com/sticky-footer/页脚粘贴到窗口的底部,除非内容将它压下窗口底部。 – HJ05
我试过了,但我无法让它工作。我有以下代码 'html,body {height}:100%; } .zone-content-wrapper {0}最低高度:100%; 身高:自动!重要; 身高:100%; margin:0 auto -4em; } .section-footer,.push { \t height:4em; ' }' – ipman