 <p>Try like this:</p> <pre><code>var windowheight = $(window).height(); var dynamicContentHeight = $(window).height(); var headerHeight = $("#header").height(); var footerHeight = $("#footer").height(); var gridheight = windowheight - headerHeight - footerHeight - dynamicContentHeight; $("#gridheight").css("height", gridheight); </code></pre>