让footer始终位于页面的最底部不随滚动而滚动
让footer始终位于页面的最底部不随滚动而滚动
发布时间:2016-12-27 来源:查字典编辑
摘要:html代码:第一种情况:footer随着滚动条的滚动而滚动.container{position:relative;width:100%;...

html代码:

<div>

<div cass="header"></div>

<div></div>

<div></div>

</div>

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

.container{position:relative;width:100%;min-height: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%,否则将无法随滚动条的滚动而滚动.

推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
相关阅读
网友关注
最新 Div+Css教程学习
热门 Div+Css教程学习
网页设计子分类