Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'd just use javascript to iterate through the list of pertinent divs, getting the height of the tallest one. I'd then go through and se the height of all of them explicitly.</p> <p>Consider the following:</p> <p><strong>CSS:</strong></p> <pre><code>#container { display: inline-block; width: 25%; /* for the sake of the example only. serves no purpose other than forcing two rows of 3 items, when viewed on a 1366px wide monitor */ } .floatLeft { float: left; border: solid 2px red; /* also only for the sake of the example */ } </code></pre> <p><strong>HTML:</strong></p> <pre><code>&lt;body&gt; &lt;div id='container'&gt; &lt;div class='floatLeft'&gt; This has 1 line &lt;/div&gt; &lt;div class='floatLeft'&gt; This has 1 line&lt;br&gt; This has 1 line &lt;/div&gt; &lt;div class='floatLeft'&gt; This has 1 line&lt;br&gt; This has 1 line&lt;br&gt; This has 1 line &lt;/div&gt; &lt;div class='floatLeft'&gt; This has 1 line&lt;br&gt; This has 1 line&lt;br&gt; This has 1 line&lt;br&gt; This has 1 line &lt;/div&gt; &lt;div class='floatLeft'&gt; This has 1 line&lt;br&gt; This has 1 line&lt;br&gt; This has 1 line&lt;br&gt; This has 1 line&lt;br&gt; This has 1 line &lt;/div&gt; &lt;div class='floatLeft'&gt; This has 1 line&lt;br&gt; This has 1 line&lt;br&gt; This has 1 line&lt;br&gt; This has 1 line&lt;br&gt; This has 1 line&lt;br&gt; This has 1 line &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; </code></pre> <p>and finally, where the 'magic' happens: <strong>JAVASCRIPT:</strong></p> <pre><code>function setHeights() { var divList = document.getElementsByClassName('floatLeft'); var i, n = divList.length; var maxHeight = 0; for (i=0; i&lt;n; i++) { if (divList[i].clientHeight &gt; maxHeight) maxHeight = divList[i].clientHeight; } for (i=0; i&lt;n; i++) divList[i].style.height = maxHeight + "px"; } </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.
    1. This table or related slice is empty.
    1. VO
      singulars
      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