Page-Details : Making Columns Render with Equal Height | JavaScriptSource

Page-Details : Making Columns Render with Equal Height

Roy Marchand Apr 23, 2007


A problem sometimes faced by Web developers is trying to get two (or more) columns in a multi-column layout to be the same height when the content is variable. Rather than using an arbitrary hardcoded value, the heights can be equalized (to the tallest one) with this script.


Assuming two columns in div tags with ids of "leftside" and "rightside" this script will set the height of the shorter to the height of the taller one. The page must be in standards compliant mode with a valid doctype or IE will mess it up in quirks mode. Just change the ids in the script to match the ones on your page.

Source Code

Paste this source code into the designated areas.

External file

Paste this code into an external JavaScript file named: columnsEqualHeight.js


Paste this code into the HEAD section of your HTML document.

Leave a Response


You might want to try [a href=""]this one[/a].

Lee Nov 6, 2007

How do I apply this code to a flexible Layout. After Testing it on one of my websites, I found that the script does not recalculate the height of the columns after resizing the window.

William Oct 3, 2007