I want to make a layout like the attached image.Blocks will render on the page in the same order number.
For example :- block(1) will show first after then block (2) and so on...
I want to make a layout like the attached image.Blocks will render on the page in the same order number.
For example :- block(1) will show first after then block (2) and so on...
Masonry is a popular JS library to handle this: http://masonry.desandro.com/
Assuming your HTML looks like this:
<div id="container">
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<!-- More items... -->
</div>
The JS would look like this:
var msnry = new Masonry('#container', {
columnWidth: 200,
itemSelector: '.item'
});
Or if you prefer jQuery:
$('#container').masonry({
columnWidth: 200,
itemSelector: '.item'
});
ah! this one below works perfectly. Check this bootply i quickly did.
<div class="col-sm-3">
<div class="col-sm-12">1</div>
<div class="col-sm-12">5</div>
</div>
<div class="col-sm-3">
<div class="col-sm-12">2</div>
<div class="col-sm-12">6</div>
</div>
<div class="col-sm-3">
<div class="col-sm-12">3</div>
<div class="col-sm-12">7</div>
</div>
<div class="col-sm-3">
<div class="col-sm-12">4</div>
<div class="col-sm-12">8</div>
</div>