Html 使页脚粘在底部
所以我试着让页脚像这样粘在页面底部 (缩小,页脚仍保留在底部) 我怎样才能做到这一点 这是我做的一个测试,请帮助我理解我需要做什么,因为页脚没有停留在底部。Html 使页脚粘在底部,html,css,Html,Css,所以我试着让页脚像这样粘在页面底部 (缩小,页脚仍保留在底部) 我怎样才能做到这一点 这是我做的一个测试,请帮助我理解我需要做什么,因为页脚没有停留在底部。 这可以通过固定定位轻松实现: .body .mainfooter { height: auto; margin-top: 0; margin-bottom: 0; position: fixed; bottom: 0; } ..//如果我们说这是页脚div #页脚{ 显示:块; 位置:固定; 底部
这可以通过固定定位轻松实现:
.body .mainfooter {
height: auto;
margin-top: 0;
margin-bottom: 0;
position: fixed;
bottom: 0;
}
..//如果我们说这是页脚div
#页脚{
显示:块;
位置:固定;
底部:0px;
高度:70像素;
}
你需要自己研究,关于这方面的教程可以在网站上找到。我确实在那个网站上看过,我试图模仿我应该做的事情,但我不知道我的css中是否有错误。不要尝试模仿,尝试查找教程副本:记住,在移动设备上查看固定页脚和页眉时,它们是一团乱麻,行为不一样,相当糟糕。我的意见是,如果可以的话,你应该尽量避免它们。我们也可以使用媒体查询将移动设备的固定位置切换到相对位置。
<div id='footer'>...</div> // if we say that this is the footer div
<style type='text/css'>
#footer{
display:block;
position:fixed;
bottom:0px;
height:70px;
}
</style>