Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get rid of Gutter in TwitterBootstrap

Maybe I'm crazy but is there not a way to get rid of the 20px gutter on the twitter bootstrap? For example I've used frameworks that use an alpha and omega that over-ride the gutter to give it a margin:0px; I'm not currently seeing anything like this in the twitter bootstrap documentation.

like image 222
bryanlewis Avatar asked Apr 25 '12 15:04

bryanlewis


People also ask

How do I remove the gutter space in Bootstrap?

The gutters between columns in our predefined grid classes can be removed with .g-0 . This removes the negative margin s from .row and the horizontal padding from all immediate children columns.

How do you remove gutters from Bootstrap 4?

By default, Bootstrap 4 has class=”no-gutters” to remove gutter spaces of any specific div. The following image shows the highlighted gutter space and space between columns on bootstrap 4 12 column grid system. You can even modify gutter width by reducing 15px width of gutter space between each columns.

How do I change the width of a gutter in Bootstrap?

The Bootstrap grid allows 12 columns with 30 px wide gutters by default, but these numbers can be adjusted. Just check the Grid System block on the Customize page. The @grid-columns field allows to set a different number of columns, and the @grid-gutter-width field lets you change the gutter width.


2 Answers

With the bootstrap you don't need a class to remove the gutter, it is removed by the .row class where you place your span divs automatically so everything sits nicely within the grid.

.row {
    margin-left: -20px;
}

A little clarification.

The other frameworks, such as the 960.gs grid, use an .alpha and .omega to remove the excess margin on the left or right of a grid so they can sit the grid elements nicely within a line. With the bootstrap this is not the case anymore since the grid has that excess margin removed by the .row div, which is required to have your .span divs sit nicely within the grid.

like image 141
Andres Ilich Avatar answered Nov 15 '22 21:11

Andres Ilich


UPDATE:

Don't see anything in the documentation either, but here is a fix:

If you want to remove the gutter on the left and right ends of your container, you will have to add a class for the .alpha and the .omega.

.alpha { margin-left: 0; }
.omega { margin-right: 0; }

If you want to change all the gutters:

In the variables.less file, you can change the Gutter width:

// GRID
// --------------------------------------------------

// Default 940px grid
// -------------------------

@gridGutterWidth: 20px;
like image 27
Karl Avatar answered Nov 15 '22 21:11

Karl