当网页内容区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及以上

芜湖不芜
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);我感觉这个调整比较可靠一点的
添加回答
举报
0/150
提交
取消