Jump to content

Align two text input fields


rv20

Recommended Posts

Trying to align a label or just text) inforont of two textobxes but the textboxes are not aligned with each other, any ideas,

<form method='post' action="login.php">
<label for "uname">Name:</label>
<input type="text" name="uname" size="16" />

<label for "pword">Password:</label>
<input type="text" name="pword" size="16" />

<input type="submit" name="submit" value="login" />
</form>

Link to comment
https://forums.phpfreaks.com/topic/159298-align-two-text-input-fields/
Share on other sites

use some CSS :-)

<form method='post' action="login.php">
<div style="width:300px;">
	<label for="name" style="float:left;">Name:</label>
		<input type="text" name="uname" id="name" size="16" style="float:right;clear:right"/>
	<label for="pass" style="float:left;clear:left">Password:</label>
		<input type="text" name="pword" id="pass" size="16" style="float:right;clear:right"/>
	<input type="submit" name="submit" value="login" style="float:right;clear:both;"/>
</div>
</form>

Also fixed some errors u had in your code...

Try it out: http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_label

to have the labels and the text fields closer together adjust the overall width of the div wrapping your elements...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.