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

Horizontal form is unable to align long label vertically with input #12939

Closed
lunak86 opened this issue Mar 5, 2014 · 5 comments
Closed

Horizontal form is unable to align long label vertically with input #12939

lunak86 opened this issue Mar 5, 2014 · 5 comments
Labels

Comments

@lunak86
Copy link

lunak86 commented Mar 5, 2014

I have got a long label next to my input and according to my review there is no way how to align them vertically (without setting a margin property on the long input what cannot be done automatically) in horizontal form. It is OK with a short label.

 <form class="form-horizontal" role="form">
  <div class="form-group">
    <label for="input1" class="col-lg-2 control-label">
        Labdas kjas kljas dlkjasd lksjd el1
    </label>
    <div class="col-lg-10">
      <input type="text" class="form-control" id="input1" placeholder="Input1">
    </div>
  </div>
  <div class="form-group">
    <label for="input2" class="col-lg-2 control-label">Label2</label>
    <div class="col-lg-10">
      <input type="password" class="form-control" id="input2" placeholder="Input2">
    </div>
  </div>
</form>
@juthilo juthilo added the css label Mar 5, 2014
@cvrebert
Copy link
Collaborator

cvrebert commented Mar 6, 2014

Made the example into a JS Fiddle: http://jsfiddle.net/fdX46/1/

@cvrebert
Copy link
Collaborator

cvrebert commented Mar 6, 2014

Looks properly aligned to me:
shot1
(Using Chrome on OS X Mavericks)
The text of both the input and the first line of the label have the same baseline.

@lunak86
Copy link
Author

lunak86 commented Mar 6, 2014

Hi cvrebert, thanks for your comment. Yes, "the text of both the input and the first line" is exactly what I mean. My expected result is that the vertical center of the input and the vertical center of the 2-lines label should have the same baseline. Because when you have f.ex. 5 inputs and one of them has two lines then it does not look well aligned.

I've been using this workaround in Bootstrap 2:

.form-horizontal .control-label {
    display: inline-block;
    vertical-align: middle;
    float: none;
}
.form-horizontal .controls {
    display: inline-block;
    margin-left: 20px;
}

But I am not able to solve it twbs3.

@mdo
Copy link
Member

mdo commented Mar 10, 2014

We won't be changing this for the time being. Your CSS changes the layout of the forms as they all need to be floated for proper alignment. We'll do our best come v4 to improve form layout again <3.

@mdo mdo closed this as completed Mar 10, 2014
@gopalkumar315
Copy link

thanks

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

5 participants