手机
当前位置:查字典教程网 >网页设计 > 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始终位于页面的最底部不随滚动而滚动】相关文章:

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

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

使用css3仿造window7的开始菜单

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

Div+CSS实例教程:让页脚保持在未满屏页面的底部

如何用CSS让文字居于div的底部

连续循环向上滚动代码

CSS中使用counter()在列表中自动添加序号

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

CSS定义Radio单选项和Checkbox复选框样式有效代码

精品推荐
分类导航