Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to center a width unknown button in a bootstrap's span?

I have a button generated by backbone.js and jQuery.tmpl() and width of the button is variant. I want to put it in a span6 div. Code is shown below:

<div class="row">
  <div class="span6">
    <button class="btn primary large">
      BLABLABLA
    </button>
  </div>
  <div class="span10">
    ...
  </div>
</div>

I don't know how to make the button centered in the div.

like image 977
Alex Chen Avatar asked Oct 29 '11 18:10

Alex Chen


2 Answers

Im no CSS guru but this does the trick for me (centers the button within the span6):

<div class="row">
  <div class="span6" style="text-align:center">
    <button class="btn primary large">
      BLABLABLA
    </button>
  </div>
</div>

More info on centering can be found here.

like image 72
dgorissen Avatar answered Oct 12 '22 00:10

dgorissen


A bit late but you can use the pagination-centered class from bootstrap

<div class="span6 pagination-centered">
  <button class="btn primary large">
    BLABLABLA
  </button>
</div>
like image 28
Zeograd Avatar answered Oct 12 '22 00:10

Zeograd