html页脚挡住内容,css让页脚始终在底部不论页面内容多少

让页脚始终在页面底部,不论页面内容是多或者少页脚始终在页面底部。

方案一:

复制代码代码如下:

body,html {

margin: 0;

padding: 0;

height:100%;

}

#main {

position: relative;

min-height:100%;

background:#eee;

}

#content {

padding: 10px;

padding-bottom: 100px;

}

#footer {

position: absolute;

bottom: 0;

height: 100px;

width: 100%;

background:lightblue;

}

for(var i=0; i<400; i++){

document.write(i+'
');

}

方案二:

复制代码代码如下:

css实现页脚始终在最底部

* {padding: 0;margin: 0;}

html {*overflow: auto;}

body {_width: expression(this.parentNode.clientWidth);}

html,body {height: 100%;}

.section {min-height: 100%;_height: 100%;}

.footer {height: 60px;background: #000;margin-top: -60px;color: #FFF;}

for(var i=0; i<400; i++){

document.write(i+'
');

}

让页脚始终固定在屏幕底部:

复制代码代码如下:

body{margin:0px;padding:0px;overflow:hidden;padding-top:22px;padding-bottom:22px;}

#header{background-color:blue;color:white;position:absolute;top:0px;left:0px;height:16px;width:100%;}

#content{background-color:yellow;width:100%;height:100%;overflow:auto}

#footer{background-color:green;color:white;width:100%;height:16px;position:absolute;bottom:0px;left:0px;}

for(i=0;i<1000;i++){

document.write(i+"

");

}

footer
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值