 <p>Like this</p> <pre><code>$(function() { $(window).on('resize', function() { $('.wrapper').css('margin-top', function() { return ($(document).height() - $(this).height()) / 2; }); }).trigger('resize'); }); </code></pre> <p><a href="http://jsfiddle.net/adeneo/sLVLt/2/" rel="nofollow"><strong>FIDDLE</strong></a></p>