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

当网页内容区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;
}
慕妹3242003
浏览 1259回答 2
2回答

蝴蝶刀刀

这样写: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及以上

芜湖不芜

我也遇到过这样的问题,我就这样解决的了: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);我感觉这个调整比较可靠一点的
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript