Take the 2-minute tour ×

How would we prevent the excess space, say between A and D. http://jsfiddle.net/samarthwiz/4KCSx/

<div style="height: 170px">LONGER</div>
<div style="height: 100px">SHORTER</div>
share|improve this question

2 Answers 2

I do not think this is possible with CSS alone. However, there are several tools that use JavaScript to dynamically organize blocks for optimal use of space. The one I'm most familiar with is Masonry: http://masonry.desandro.com/

share|improve this answer

you can do it like this,see the below link www.jsfiddle.net/4KCSx/1/

share|improve this answer

Your Answer


