Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

center two columns with bootstrap

I'm trying to center two columns that are inside one container:

<div class="container">
<div class="row">
    <div class="col-md-5">
    ...
    </div>
    <div class="col-md-3">
    </div>
</div>
</div>

but I'm getting all my divs at the left side. I know that both columns are taken 8 columns, So I'm missing 4 of them, But how can I ignore those 4 columns and just center my container? I know how to do this with simple css but I supose bootstrap handle this in a better way to make it responsive.

like image 601
napstercake Avatar asked Oct 28 '25 00:10

napstercake


1 Answers

Try this:

<div class="container">
<div class="row">
    <div class="col-md-5 col-md-offset-2">
    ...
    </div>
    <div class="col-md-3">
    </div>
</div>
</div>

Since you have 4 columns extra, you need to move 2 columns from the left (col-md-offset-2).

like image 114
Arda Keskiner Avatar answered Oct 29 '25 15:10

Arda Keskiner