100% height div not working

Sometimes, even with a lot of tricky css, you still can’t get a div to stretch to the height of it’s parent. Sometimes this height is also determined by an adjacent table cell. In this case, JavaScript and jQuery come in handy.

        jQuery('.innerWrapper').css('height', 'auto');
        var maxHeight = 0;
        jQuery('td.outerCell').each(function() {
            var height = jQuery(this).outerHeight();
            if (height > maxHeight) {
                maxHeight = height;
        jQuery('.innerWrapper').css('height', maxHeight);

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s