Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

bootstrap form-horizontal right align labels

If it possible to get right-align labels in twitter bootstrap form-horizontal?

So in this example of horizontal form http://twitter.github.com/bootstrap/base-css.html#forms letter "E" in "Email" will be over letter "P" in "Password".

like image 351
user1735930 Avatar asked Oct 10 '12 19:10

user1735930


People also ask

How do I align a label to the right in Bootstrap?

Use the . form-horizontal class in Bootstrap to align labels and groups of form controls in a horizontal layout.

How do you right align a label?

We specify the margin-bottom of our <div> element. Then, we set the display of the <label> element to "inline-block" and give a fixed width. After that, set the text-align property to "right", and the labels will be aligned with the inputs on the right side.

How do I create a horizontal form in Bootstrap?

Horizontal formCreate horizontal forms with the grid by adding the .row class to form groups and using the .col-*-* classes to specify the width of your labels and controls. Be sure to add .col-form-label to your <label> s as well so they're vertically centered with their associated form controls.

How do I align a text box to the right in Bootstrap?

Bootstrap allows us to align elements by using the utility class float. As we want to align the button to the right side of the text box, we have to use the float-right class.


1 Answers

Actually, they are right aligned as it is. I think you want to left align them (so P is over E) if I understand correctly. If so, you can try this:

.form-horizontal .control-label {
    text-align: left;
}

(it's "text-align: right;" by default in bootstrap.css)

like image 57
Piotr Kempa Avatar answered Nov 04 '22 02:11

Piotr Kempa