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

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

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

CSS基础教程:CSS的color颜色

DIV+css初学者需要引起重视的10个问题与技巧

CSS经典技巧十则

css清除浮动方法和代码

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

CSS中常用的缩写方式

通过CSS让TD自动换行

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

精品推荐
分类导航