好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

让footer始终位于页面的最底部不随滚动而滚动

ht ML 代码:

复制代码

代码如下:


<div class="cont ai ner">
<div cass="header"></div>
<div class="body"></div>
<div class="footer"></div>
</div>


第一种情况:footer随着滚动条的滚动而滚动

复制代码

代码如下:

@H_ 512 _29@
.container{pos IT ion:relative;width:100% ;m in-h ei ght:100%;}
.body{padding-bottom:50px;}
.footer{height:50px;position:absolute;bottom:0px;left:0px;}


第二种情况:footer始终在其底部固定

复制代码

代码如下:


.container{position:relative;width:100%;min-height:100%;}
.body{padding-bottom:50px;}
.footer{height:50px;position:fixed;bottom:0px;left:0px;}


注意:

1.千万不能设置.container的高度为100%,否则将无法随滚动条的滚动而滚动.

总结

以上是 为你收集整理的 让footer始终位于页面的最底部不随滚动而滚动 全部内容,希望文章能够帮你解决 让footer始终位于页面的最底部不随滚动而滚动 所遇到的问题。

如果觉得 网站内容还不错, 推荐好友。

查看更多关于让footer始终位于页面的最底部不随滚动而滚动的详细内容...

  阅读:18次