Hi,
i'm doing a registration form, and i'm aligning the labels and textbox's. But they are very close of each other, so i put a td between the td's which are seperating the label and the textbox.

<tr>
			<td align="right">
				<br/>
				<div class="field"><label>Username*: </label>
			</td>
			
			<td>
			</td>
			
			<td>
				<input type="text" size="30" name = "username"/></div>
			</td>
		</tr>

But hte problem is that the textbox...:
http://img850.imageshack.us/img850/5910/semttulopc.jpg

And if you can help me you could tell me how to change the size and type of the font... xD

Thank you,
PF2G

Member Avatar for diafol

THis isn't php , but how about placing the textbox in the second cell as opposed to the third? The use of a div across tds is wrong. HTML needs to be 'well-formed'. I don't see why you need a div at all. Additionally if you want a form control to span more than one cell you can do this:

<td colspan="2"><input name="username" id="username" class="double" /></td>

Then in your CSS:

input[type=text]{
   width: 100px;
}
input.double{
   width: 200px;
}

The first rule gives textboxes a default width of 100px, while any control with the class=double has a width of 200px.

There are a few ways which you could do this - this is just one.

Looks like you finish divs and labels sporadic places:
for aligning in a table you can (However I think this is in the html forum if that exists)

<table>
<tr>
<td>Username*:</td><td><input type"text" name="username" /></td>
</tr>
<tr>
<td>Password*:</td><td><input type"password" name="pass1" /></td>
</tr>
<tr>
<td>Confirm Password*:</td><td><input type"password" name="pass2" /></td>
</tr>
<table>

And then add padding for the td..

<td colspan="2"><input name="username" id="username" class="double" /></td>

Then in your CSS:

input[type=text]{
   width: 100px;
}
input.double{
   width: 200px;
}

It gives me the same thing the text box goes "all" to the left.

Member Avatar for diafol

SHow the code you're now using, including relevant CSS and table html.

Second thoughts - ask a mod to move this thread to the right forum. THis ain't php

top.php

<style type="text/css">
input[type=text]{
   width: 100px;
}
input.double{
   width: 200px;
}
</style>

registration.php

<tr>
			<td align="right">
				<br/>
				<div class="field"><label>Username*: </label>
			</td>
			
			<td>
			</td>
			
			<td colspan="2">
				<input name="username" id="username" class="double" />
			</td>
		</tr>
Member Avatar for diafol

What's this for?

<td></td>

The whole point of having colspan="2" is that you merge 2 td tags:

<td></td><td></td> -> <td colspan="2"></td>

What's this for?

<td></td>

The whole point of having colspan="2" is that you merge 2 td tags:

<td></td><td></td> -> <td colspan="2"></td>

So, is this correct:

<tr>
			<td align="right">
				<br/>
				<div class="field"><label>Username*: </label>
			</td>
			
			<td>
			</td>
			
			<td>
				<input name="username" id="username" class="double" />
			</td>
		</tr>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.