$(function(){ $("#div_all").css({ top:function(){ return ($(document).height()-$("#div_all").height())/2; } }); })