Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Centre align div content in bootstrap

I want my date picker to be in the middle of the page, eg. the line where I have: <div class="center-block text-center datepicker"></div>

Obviously center-block and text-center I tried already - but neither change anything. And with the offset it just makes it close to the centre without being perfectly centre aligned.

What do I need to do?

Thanks

<div class='row'>
  <div class='col-sm-12'>
    <div class='page-header page-header-with-icon mg-t'> <i class='fa-icon-calendar'></i>

      <h2>Calendar</h2>

    </div>
    <div class="row">
      <div class="col-sm-4 col-sm-offset-4">
        <div class="center-block text-center datepicker"></div>
      </div>
    </div>
  </div>
</div>
like image 360
b85411 Avatar asked Oct 19 '22 09:10

b85411


1 Answers

Try something like this:

<div class="col-sm-12">
    <div class="datepicker"></div>
</div>

Then give the date picker something like:

.datepicker {
   display:inline-block;
   margin:0 auto;
}

I haven't tested this, but it would be where I would start.

like image 196
Josh York Avatar answered Oct 24 '22 12:10

Josh York