Reputation: 52
how to do like this image using bootstrap ?
This is my code what is mistake in this code please help me.
<div class="row">
<div class="img-5">
<div class="col-md-4">
<div class="hn-img-1">
<img src="img/1.jpg" alt="">
</div>
</div>
<div class="col-md-4">
<div class="hn-img-1">
<img src="img/2.jpg" alt="">
</div>
</div>
<div class="col-md-4">
<div class="hn-img-1">
<img src="img/3.jpg" alt="">
</div>
</div>
<div class="col-md-4">
<div class="hn-img-1">
img src="img/5.jpg" alt="">
</div>
</div>
<div class="col-md-4">
<div class="hn-img-1">
<img src="img/4.jpg" alt="" class="mt-top">
</div>
</div>
</div>
</div>
and result is this,
This is my code result.
Upvotes: 1
Views: 81
Reputation: 116
Look at this image to have a basic knowledge about the grid. Use grid layout to distribute the page as per your need.
Upvotes: 0
Reputation: 1515
Bootstrap has a 12 column grid system. So you should divide your grids in such a way that the sum total of the grid comes out to be 12.
The Mistake: You are using 5 div col-md-4
with 4 grids each. That means your total sum of the grid comes to be 20. But, it should be 12. In some cases sum of grids greater than 12, might just work (in using col-sm-*
). But it is strongly advised to use 12 grid system.
So what you should do is:
col-md-4
you should use only 3 col-md-4
(total sum of grids = 12).This should do the trick. Here's the JSFiddle demo. (Since md
stands for medium device, what we are communicating to our column div elements is that when the available screen space is equal to or greater than a “medium device” (992px and up) amend the widths of these elements to match the column number in the md
class name. Make sure that the output window in JSFiddle is of max width to see the results, else all the images will stack under one another)
Hope it helps, let me know if you have some problem.
Upvotes: 1
Reputation: 281606
You can make use of nested rows to create the structure as you want. This is a sample code that can lead you to the design you want.
<div class="row">
<div class="col-md-4">
<div class="row">
<div class="col-md-12">
<div class="well">2</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="well">4</div>
</div>
</div>
</div>
<div class="col-md-4">
<div class="well">1
<br/>
<br/>
<br/>
<br/>
<br/>
</div>
</div>
<div class="col-md-4">
<div class="row">
<div class="col-md-12">
<div class="well">2</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="well">4</div>
</div>
</div>
</div>
</div>
Upvotes: 1
Reputation: 977
Bootstrap divide the screen in 12 columns, you sholud have only 3 columns md-4 y one row. And in the first column put 2 images, in the middle column put the big image and in the last column the two remaining images.
Upvotes: 0
Reputation:
Under the you should remove because under ROW you should only use what you want to be in the grid by using classes like col-sm-* or col-md-* you also have yo use classes like .col-md-offset-* if you want empty space before the current div in the grid.
Upvotes: 0