I want to build a form in Bootstrap 3 like this:
My site (not the above link) just updates from Bootstrap 2.3.2 and the format is not correct anymore.
I cannot find any doc about this type of form on getbootstrap.com.
Could anyone tell me how to do this? Only 'Username' would be OK.
Thanks.
PS There is a similar question but it's using Bootstrap 2.3.2.
I have created a demo for you.
Here is how your nested structure should be in Bootstrap 3:
Notice how the whole
form-inline
is nested within thecol-xs-10
div containing the control of the horizontal form. In other terms, the wholeform-inline
is the "control" of the birthday label in the main horizontal form.Note that you will encounter a left and right margin problem by nesting the inline form within the horizontal form. To fix this, add this to your css:
Another option is to put all of the fields that you want on a single line within a single
form-group
.See demo here
I had problems aligning the label to the input(s) elements so I transferred the label element inside the form-inline and form-group too...and it works..
To make it work in Chrome (and bootply) i had to change code in this way:
This Bootply example seems like a much better option. Only thing is that the labels are a little too high so I added
padding-top:5px
to center them with my inputs.