You can use a simple jQuery solution:
function calc() { var $window = $(window), $nav = $('nav'), $content = $('#content'); $content.height($window.height() - $nav.height()); }
DEMO
PS: You can actually define an min-height for the content div via css.
EDIT:
If you plan on using plain JavaScript, here is a solution:
var w = window, d = document, e = d.documentElement, g = d.getElementsByTagName('body')[0]; w.onload = calc(); w.onresize = calc(); function calc() { var nav = d.getElementById('nav'), content = d.getElementById('content'); content.style.height = (getWindowHeight() - nav.clientHeight) + 'px'; } function getWindowHeight() { return w.innerHeight|| e.clientHeight|| g.clientHeight; }
DEMO
DEMO WITH MIN-HEIGHT 300px