I am trying to get 4 columns in a row.
Code:
<div class="banner-static" style="margin-top: 30px; margin-bottom: 15px;">
<div class="row">
<div class="home-banner">
<div class="col2 col-xs-12 col-sm-4 col-md-4">
<p class="img3">
<a href="#">
<img class="top" src="/img/cms/banner1_hover.jpg" alt="" />
<img class="bottom" src="/img/cms/banner1.jpg" alt="" />
</a>
</p>
</div>
<div class="col2 col-xs-12 col-sm-4 col-md-4">
<p class="img3">
<a href="#">
<img class="top" src="/img/cms/banner2_hover.jpg" alt="" />
<img class="bottom" src="/img/cms/banner2.jpg" alt="" />
</a>
</p>
</div>
<div class="col2 col-xs-12 col-sm-4 col-md-4">
<p class="img3">
<a href="#">
<img class="top" src="/img/cms/banner3_hover.jpg" alt="" />
<img class="bottom" src="/img/cms/banner3.jpg" alt="" />
</a>
</p>
</div>
<div class="col2 col-xs-12 col-sm-4 col-md-4">
<p class="img3">
<a href="#">
<img class="top" src="/img/cms/banner3_hover.jpg" alt="" />
<img class="bottom" src="/img/cms/banner3.jpg" alt="" />
</a>
</p>
</div>
</div>
</div>
</div>
But i only get 3 columns, the last image jumps into to next row. Can somebody point me into the right direction ?
Thanks
4
Answers
Replace
col-sm-4
andcol-md-4
withcol-sm-3
andcol-md-3
. Twitter Bootstrap is a 12 column grid system and hence 4+4+4+4= 16 will push the last column to next row.Just apply the col-sm-3, col-md-3 class on columns instead of col-sm-4, col-md-4.
Try this
The Bootstrap grid is split up into 12 columns. Divide 12 by the number of columns you want, and you will get the number for that class.
For example, 12 divided by 4, is 3. So your classes should be col-sm-3 and col-md-3.
https://getbootstrap.com/examples/grid/