Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Align label with button

It's easier to explain what I need with a fiddle: http://jsfiddle.net/mZrYG/1/

As you can see, when the output screen is fully extended, the sign in button is placed on the line under the label. I'm trying to get it so that the checkbox is left aligned and the button is right aligned on the same line. What's wrong with my css?

For prosperity:

<div class="row">
   <div class="span3">
      <form class="signin" method="POST">
         <input type="text" placeholder="Username" name="username" />
         <input type="password" placeholder="Password" name="password" />
         <label class="checkbox">
         <input type="checkbox" name="form[remember]" /> Remember me
         </label>
         <button class="btn btn-mini btn-primary pull-right" type="submit">Sign in</button>
      </form>
   </div>
</div>​
like image 976
qwertymk Avatar asked Nov 20 '12 04:11

qwertymk


People also ask

How do I center a label in a button?

We can align the buttons horizontally as well as vertically. We can center the button by using the following methods: text-align: center - By setting the value of text-align property of parent div tag to the center. margin: auto - By setting the value of margin property to auto.

How do you align labels?

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 right align text in a label?

Align the text left or right Select the text that you want to align. On the Home tab, in the Paragraph group, click Align Left or Align Right .


1 Answers

Demo

Hi now used to display:inline-block in your label

as like this

label {
    display: inline-block;
    margin-bottom: 5px;
    vertical-align: top;
}
like image 185
Rohit Azad Malik Avatar answered Sep 26 '22 03:09

Rohit Azad Malik