This question is a follow-up to how can I make bootstrap columns all the same height. Based on one suggested solution I set up a js fiddle example to illustrate my problem, http://jsfiddle.net/4d666/
<div class="container">
<div><h2 class="hero">a very long title</h2></div>
<div class="row">
<div class="col-md-4" style="border: 1px solid black;">
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
</div>
<div class="col-md-4" style="border: 1px solid black;">
<p>foo</p>
</div>
<div class="col-md-4" style="border: 1px solid black;">
<p>foo</p>
</div>
</div>
<div><h2 class="hero">a very long title</h2></div>
<div class="row">
<div class="col-md-4" style="border: 1px solid black;">
<p>test</p>
<p>test</p>
<p>test</p>
<p>test</p>
</div>
<div class="col-md-4" style="border: 1px solid black;">
<p>foo</p>
</div>
</div>
</div>
And the corresponding css inspired from bootstrap 3 responsive columns of same height.
/* try to remove this css to see the effect */
.container{
display:table;
}
.row {
display: table-row;
}
.row [class*="col-"] {
float: none;
display: table-cell;
vertical-align: top;
}
The html in the fiddle shows my goal: I have a container with headings and rows and would like to have the columns aligned by height. The headings and the rows should be left aligned. When you run the fiddle without the css, you'll see the basic idea (the columns will not have the same size in that case). You can resize the result panel to see the columns collapse underneath each other (when the screen gets too small, as expected). When you run the fiddle with the css, you'll notice that the h2 text breaks after each word and is no longer aligned with the columns. Also resizing the panel makes the columns tremendously small but doesn't break them anymore.
I modified the fiddle to include the original answer which can be found here. The h2 alignes correctly this time but the second row doesn't align with the first row. Also as you resize the result panel, the columns do no longer collapse.
Is it possible to achieve this via css? or is javascript the only alternative?