为了账号安全,请及时绑定邮箱和手机立即绑定

给html,body设置min-height 没有作用?

给html,body设置min-height 没有作用?

慕妹3242003 2019-04-19 16:30:02
当网页内容区content东西很少时,footer就会跑到上边来?我给body,html设min-height:100%;没有作用,设置height:100%;就好了,但是内容多了就在一屏下?body,html{min-height:100%;}body{position:relative;}.content{podding-bottom:100px;}.footer{position:absolute;bottom:0;left:0;height:100px;}
查看完整描述

2 回答

?
蝴蝶刀刀

TA贡献1801条经验 获得超8个赞

这样写:
html{
height:100%;
}
body{
position:relative;
min-height:100%;
box-sizing:border-box;
padding-bottom:80px;/*.footer的高度,为footer占位*/
}
.footer{
position:absolute;
bottom:0;
left:0;
width:100%;
height:80px;
}
上面的代码兼容到IE8及以上
                            
查看完整回答
反对 回复 2019-04-19
?
芜湖不芜

TA贡献1796条经验 获得超7个赞

我也遇到过这样的问题,我就这样解决的了:
html,body,.content{
min-height:100%;
}
html{
-ms-text-size-adjust:100%;
-webkit-text-size-adjust:100%;
}
body{
background:#eeeeee;
}
然后用js控制让$(".content").height($("html").height);我感觉这个调整比较可靠一点的
                            
查看完整回答
反对 回复 2019-04-19
  • 2 回答
  • 0 关注
  • 1258 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号