Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Twitter Bootstrap - add top space between rows

How to add margin top to class="row" elements using twitter bootstrap framework?

like image 915
itsme Avatar asked Apr 10 '12 08:04

itsme


People also ask

How do I add spacing between rows in bootstrap?

If you need to separate rows in bootstrap, you can simply use . form-group . This adds 15px margin to the bottom of row.

How do I space in bootstrap?

1 - (by default) for classes that set the margin or padding to $spacer * .25. 2 - (by default) for classes that set the margin or padding to $spacer * .5. 3 - (by default) for classes that set the margin or padding to $spacer. 4 - (by default) for classes that set the margin or padding to $spacer * 1.5.

How do I set margin in bootstrap?

l - sets margin-left or padding-left. r - sets margin-right or padding-right. x - sets both padding-left and padding-right or margin-left and margin-right. y - sets both padding-top and padding-bottom or margin-top and margin-bottom.


2 Answers

Editing or overriding the row in Twitter bootstrap is a bad idea, because this is a core part of the page scaffolding and you will need rows without a top margin.

To solve this, instead create a new class "top-buffer" that adds the standard margin that you need.

.top-buffer { margin-top:20px; } 

And then use it on the row divs where you need a top margin.

<div class="row top-buffer"> ... 
like image 156
Acyra Avatar answered Oct 15 '22 21:10

Acyra


Ok just to let you know what's happened then, i fixed using some new classes as Acyra says above:

.top5 { margin-top:5px; } .top7 { margin-top:7px; } .top10 { margin-top:10px; } .top15 { margin-top:15px; } .top17 { margin-top:17px; } .top30 { margin-top:30px; } 

whenever i want i do <div class="row top7"></div>

for better responsive you can add margin-top:7% instead of 5px for example :D

like image 45
itsme Avatar answered Oct 15 '22 21:10

itsme