Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Aligning html inputs on same line

Can somebody give a simple solution as to how to align form inputs on the same line, for example, many times when I am building a form I can get them to align on top of each other and it looks sound, but if i put two inputs like a textarea/text next to another text or a button, I get vertical alignment differences. Is there a way to fix this without fiddling with the margins and padding?

ex:

<style type='text/css'>   form{     display:inline;   }   textarea{     font-size:25px;     height:25px;     width:200px;   }   input.button{     height:25px;     width:50px;   } </style> <form>   <textarea >Value</textarea><input type='button' class='button' value='Go'> </form> 
like image 882
Ryan Stortz Avatar asked Dec 20 '11 14:12

Ryan Stortz


People also ask

How do I align text on the same line in HTML?

The text-align-last property specifies how to align the last line of a text. Notice that the text-align-last property sets the alignment for all last lines within the selected element. So, if you have a <div> with three paragraphs in it, text-align-last will apply to the last line of EACH of the paragraphs.

How do you put an input on the same line in HTML?

Use display:inline-block insted of float .

How do I align all input fields in HTML?

HTML | <input> align Attribute left: It sets the alignment of image to the left. it is a default value. right: It sets the alignment of image to the right. middle: It sets the alignment of image to the middle.

How do you align items on the same line?

To get all elements to appear on one line the easiest way is to: Set white-space property to nowrap on a parent element; Have display: inline-block set on all child elements.


1 Answers

Have you tried playing with the vertical-align css property?

vertical-align:top; 

That way everything will look consistent and you won't have to play with margins.

like image 177
Rondel Avatar answered Sep 23 '22 09:09

Rondel