Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue aligning form controls when using form-horizontal #13052

Closed
abishekrsrikaanth opened this issue Mar 13, 2014 · 3 comments
Closed

Issue aligning form controls when using form-horizontal #13052

abishekrsrikaanth opened this issue Mar 13, 2014 · 3 comments
Labels

Comments

@abishekrsrikaanth
Copy link

I am using the form-horizontal class to create my form. I am using the exact same code available at http://getbootstrap.com/css/#forms-horizontal but with a only exception that the second and third form group are col-md-6.

I have the same available on jsbin for your reference. How can i fix this alignment issue.
This used to work well in BS2, but not in BS3.

JSBin: http://jsbin.com/pebag/1/

Code for Horizontal Form:

  <form class="form-horizontal" role="form">
      <div class="col-md-12">
        <div class="form-group">
          <label class="col-md-3 control-label">Field 1</label>
          <div class="col-md-9">
            <input type="text" class="form-control" placeholder="Enter text">         
          </div>
        </div>
      </div>
      <div class="col-md-6">
        <div class="form-group">
          <label class="col-md-3 control-label">Field 1</label>
          <div class="col-md-9">
            <input type="text" class="form-control" placeholder="Enter text">         
          </div>
        </div>
      </div>
      <div class="col-md-6">
        <div class="form-group">
          <label class="col-md-3 control-label">Field 1</label>
          <div class="col-md-9">
            <input type="text" class="form-control" placeholder="Enter text">         
          </div>
        </div>
      </div>
  </form>
@felixcheruiyot
Copy link

+1 for this. Same problem here

@MrGeneric
Copy link

In the first row, your field label is 1/4 of the width, but in the second row your labels are 1/8.

The easiest thing I can think of is to change the first label to col-md-4, and the lower ones to col-md-2 so they'll be the same width, but this may not be ideal.

@cvrebert cvrebert added the css label Mar 13, 2014
@cvrebert
Copy link
Collaborator

Not a bug. Like @MrGeneric points out, this is just how the grid system works. For how-to questions, ask on StackOverflow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants