Note that there are some explanatory texts on larger screens.

plurals
  1. POForce all floating DIVs to match the height of their container
    primarykey
    data
    text
    <p>I'm trying to figure out a way to make three floating divs match the height of the largest floating div of the three (which, via the clearfix solution, is the height of their container).</p> <p>My question is exactly like <a href="https://stackoverflow.com/questions/526294/how-might-i-force-a-floating-div-to-match-the-height-of-another-floating-div/526316" title="this">this</a> question, only my question needs the requirement that the comments to the answer overlook :) ("what if the two columns have different background colors?" etc)</p> <p>So really I can't fake it. The page uses a drag &amp; drop mechanism similar to iGoogle using scriptaculous, and the dragdrop sortable containers are the floating divs. It would make things a lot easier for the user if I can force all containers to be the same height.</p> <p>The more I look for solutions, the more it looks like it can't be done with pure CSS. If that's the case and I need to use some javascript, so be it.</p> <p>Thanks in advance.</p> <p>EDIT: The link from idrumgood was a solution, but not the solution I ended up using. I ended up porting the jQuery function he suggested to prototype in order to avoid conflicts and to avoid having to load the entire jquery library for one function.</p> <p>This is the javascript function port that I ended up using: </p> <pre><code> function equalHeights(container) { var children = $A(container.immediateDescendants()); var currentTallest = 0; for (i = 0; i &lt; children.length; i++) { if (children[i].getHeight() &gt; currentTallest) { currentTallest = children[i].getHeight(); } //end if } //end for for (i = 0; i &lt; children.length; i++) { children[i].setStyle({ height: (currentTallest + 'px') }); } //end for } //end equalHeights </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload