The problem you're talking about is called "faux columns" and have been reported and described well over past few year :) http://www.alistapart.com/articles/fauxcolumns/
There are several solutions:
- use background on the containing div which will imitate the border
- use CSS3 techniques (display:table and display:table-cell, but these are not really meant for this or CSS3 flexbox which is highly experimental and probably won't work in most browsers)
- use JS to set the column height to the maximum of heights of the elements
The last solution is quite good so if you're using jQuery then it could be achieved like that:
var max=0;
$('#container').children().each(function(){
if($(this).height()>max) max = $(this).height();
});
$('#container').children().each(function(){
$(this).height(max);
});
The script iterates through all children of the container and finds the highest element. Then it iterates again and sets the maximum height to each of them.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…