ChaseQ ChaseQ - 7 months ago 9
HTML Question

How to make the grid system centered horizontally?

I want to get the grid system to center but it won't, i was thinking maybe it has something to do with my pictures' border?. here's the screen shotwhat it is right now
what i want it to be

HTML:

<div class=" container">
<div class="row">
<div class="col-md-4">
<div class="optionBorder">
<img src="images/page-1.svg" height="74px" width="50px">
</div>
</div>
<div class="col-md-4">
<div class="optionBorder">
<img src="images/page-1.svg" height="74px" width="50px">
</div>
</div>
<div class="col-md-4">
<div class="optionBorder">
<img src="images/page-1.svg" height="74px" width="50px">
</div>
</div>
</div>
</div>


CSS:

.optionBorder
{
border: 1px solid #f5f5f5;
height: 130px;
width: 130px;
line-height: 130px;
text-align: center;
}

Answer

Take another element before row with some width and make them center

for example.:

HTML

<div class="test">
  <div class="row">
    <div class="col-md-4">
      <div class="optionBorder">
        <img src="http://placehold.it/350x150" height="74px" width="50px">
      </div>
    </div>
    <div class="col-md-4">
      <div class="optionBorder">
        <img src="http://placehold.it/350x150" height="74px" width="50px">
      </div>
    </div>
    <div class="col-md-4">
      <div class="optionBorder">
        <img src="http://placehold.it/350x150" height="74px" width="50px">
      </div>
    </div>
  </div>
</div>

CSS

.test {
    width: 450px;
    margin: auto;
    margin-bottom: 15px;
}

bootply