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
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...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.