A pure CSS
solution (#content { min-height: 100%; }
) will work in a lot of cases, but not in all of them - especially IE6 and IE7.
Unfortunately, you will need to resort to a JavaScript solution in order to get the desired behavior.
This can be done by calculating the desired height for your content <div>
and setting it as a CSS property in a function:
function resizeContent() {
var contentDiv = document.getElementById('content');
var headerDiv = document.getElementById('header');
// This may need to be done differently on IE than FF, but you get the idea.
var viewPortHeight = window.innerHeight - headerDiv.clientHeight;
contentDiv.style.height =
Math.max(viewportHeight, contentDiv.clientHeight) + 'px';
}
You can then set this function as a handler for onLoad
and onResize
events:
<body onload="resizeContent()" onresize="resizeContent()">
. . .
</body>