I thought that would get the larger height of the two DIVs, and set both of them to this height, thus eliminating the white space, but it does not work. Any thoughts?
When you set the style.height or width you are measuring its content area only-
offsets measure to the outside of the element, including any padding and border lengths.
You can subtrack a % or constant from the offset,
or find the difference every time-
obj1.style.height=H+‘px’;
// get the new ‘outside’ height difference
diff=obj1.offsetHeight-H;
H=H-diff;
// set the style-height to the adjusted amount
obj1.style.height=H+‘px’; obj21.style.height=H+‘px’;
It is tempting to use clientHeight,
but it adds padding or border size for some elements in some browsers.
I m not sure if it counts border. Its adds a couple of lines to both DIVs, so it then becomes longer and taller than the longest DIV. Not sure if that makes sense.