div始终在底部

<style type="text/css">
body{margin:0;padding:0; }

html,body{height:100%;}
div{width:100%;height:100px;background:#fc9;position:absolute;top:100%;margin-top:-100px}
</style>
<div></div>

底部多高它的margin-top 就负多少。保证不留空白。

 

$(document).ready(function () {

var heighth = (document.body.clientHeight - 59);
$(".container").height(heighth); //= window.screen.height + 'px';
// alert(window.screen.height);
})

<div class="container" style=" ">

</div>

<div style=" height:59px"></div>

 

 

#footer {
    position:fixed;
    left:auto;
    right:auto;
    bottom:0;
    _position:absolute;
    _top:expression(document.documentElement.clientHeight + document.documentElement.scrollTop - this.offsetHeight);
    z-index: 1000;
    font-size:11px;
    line-height:28px;
    height:28px;
    background:url(../Office2007/footid_bg.jpg) repeat-x top;
    padding:2px 15px 0 15px;
    width:970px;
    margin:0 auto;
}
posted @ 2015-12-22 15:29  山水中华  阅读(594)  评论(0编辑  收藏  举报