Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to deal with Bootstrap 3 columns have no gap?

I am in trouble with new Bootstrap 3 grid system. I would like to create 4 columns grid. So here's my code:

<div class="row">
   <div class="col-lg-4">...</div>
   <div class="col-lg-4">...</div>
   <div class="col-lg-4">...</div>
</div>

My problem is there's no gap among the columns. Grid applies padding-left and padding-right to columns instead of margin-left and margin-right.

When I remove padding and add margin, It collapses. How am I gonna fix this? or Is there something that I couldn't undestand?

like image 472
Ali Emre Çakmakoğlu Avatar asked Aug 15 '13 10:08

Ali Emre Çakmakoğlu


People also ask

How do I remove the gutter space in Bootstrap 3?

To remove the gutter space, all you need to do is add the no-gutter class beside row in your HTML markup. It's that simple!

How do I make three equal columns in Bootstrap?

Three Equal ColumnsUse the . col class on a specified number of elements and Bootstrap will recognize how many elements there are (and create equal-width columns). In the example below, we use three col elements, which gets a width of 33.33% each.


1 Answers

If you can't use the default padding to create gaps, you'd have to add `margin-left' to the appropriate columns and also tweak the % width.

For example .col-lg-4 usually has 33% width, so you'd decrease it a little..

.col-lg-4 {
    margin-left:15px;
    width:31.6%;
}

http://bootply.com/74374

Another option would be to use a container inside the columns, and then the padding will work to create the gaps.

like image 70
Zim Avatar answered Oct 15 '22 06:10

Zim