2

I can't figure out how to center form controls in Bootstrap. I try wrapping everything in a .center div but that centers some things and screws up others.

.center
{
  text-align: center;
}
goodmanship
  • 334
  • 1
  • 13
Mike Glaz
  • 5,352
  • 8
  • 46
  • 73
  • 1
    Google is your best friend: http://stackoverflow.com/questions/10352866/center-form-using-twitter-bootstrap – David Feb 08 '13 at 19:42
  • @goodmanship I tried that. But specifically what I need is two radio buttons, centered, and inline. And I can't seem to get it. – Mike Glaz Feb 08 '13 at 20:28
  • 1
    sup bro. i think you mean @david ^ – goodmanship Feb 08 '13 at 20:53
  • 1
    Try providing us with the HTML you are using, and we'll be able to help better. – David Feb 08 '13 at 21:06
  • I found simple_form and am trying the following:
    <%= label_tag "Do you have pets?" %> <%= f.input :dogs, as: :boolean %> <%= f.input :cats, as: :boolean %>
    – Mike Glaz Feb 11 '13 at 16:45
  • possible duplicate of [bootstrap css center span7](http://stackoverflow.com/questions/9554724/bootstrap-css-center-span7) – MByD Feb 11 '13 at 20:56
  • @MByD Unlikely as that is referencing the old version of Bootstrap. – DavidG Feb 25 '15 at 10:15

1 Answers1

1

You can use the text-center class

<p class="text-center">Center aligned text.</p>

Other text alignment classes are

<p class="text-left">Left aligned text.</p>
<p class="text-center">Center aligned text.</p>
<p class="text-right">Right aligned text.</p>
<p class="text-justify">Justified text.</p>
<p class="text-nowrap">No wrap text.</p>

For detailed information please visit http://getbootstrap.com/css/

Saeed D.
  • 1,125
  • 1
  • 11
  • 23