Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

Change DIV Min-Height Dynamically

11:03 pm on Mar 28, 2009 (gmt 0)

Junior Member

5+ Year Member

joined:Sept 6, 2008
posts: 50
votes: 0

I need my script to detect the height of the viewable area of the window, then set the min-height CSS property of my div (id="wrapper") to equal that amount, essentially extending the div to the very bottom of the viewable area. My script works in Firefox, Opera, and Safari, but I'm getting "invalid argument" errors from IE and AOL about the last line of code before the final bracket. I'd love some help.

function findLivePageHeight() {
if (window.innerHeight) {
return window.innerHeight;
if (document.body.clientHeight) {
return document.body.clientHeight;
return (null);

var livePageHeight = findLivePageHeight();

function changeHeight() {
var object = document.getElementById('wrapper');
object.style.minHeight = livePageHeight + 'px';

8:53 pm on Mar 30, 2009 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member whoisgregg is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Dec 9, 2003
votes: 0

Hello j2trumpet!

min-height isn't supported by older versions of IE. What version did you test in?

8:58 pm on Mar 30, 2009 (gmt 0)

Junior Member

5+ Year Member

joined:Sept 6, 2008
votes: 0

IE 7

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members