<script> $(function(){ $(window).resize(function(){ var _height = $(window).height(); var _conheight = $('#footer').height(); var temp = (_height - _conheight)/2; if(temp>0) { $('#footer').css('margin-top', temp); }else { $('#footer').css('margin-top', 0); } }); });