手机
当前位置:查字典教程网 >网页设计 > Div+Css教程 >让footer始终位于页面的最底部不随滚动而滚动
让footer始终位于页面的最底部不随滚动而滚动
摘要: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%,否则将无法随滚动条的滚动而滚动.

【让footer始终位于页面的最底部不随滚动而滚动】相关文章:

DIV+CSS网页设计常用布局代码

连续循环向上滚动代码

CSS里随滚动条滚动代码

天猫新旺铺首页全屏滚动海报代码

图片垂直居中css写法兼容ie6

CSS在IE与Firefox下的兼容性

CSS兼容IE6、IE7、IE8和Firefox浏览器的方法

CSS基础教程:CSS的color颜色

css清除浮动方法和代码

CSS应用基础教程(6) 区块性质

精品推荐
分类导航