手机
当前位置:查字典教程网 >网页设计 > 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中使用counter()在列表中自动添加序号

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

css中默认中文字体font-family列表

页脚始终保持在页面底部的网页布局方法

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

可记忆cookie的页面简繁体转换代码

使用css3仿造window7的开始菜单

连续循环向上滚动代码

兼容各浏览器:CSS定义PNG透明效果

精品推荐
分类导航