Why are the <td>s not next to each other?

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
voltrader
Forum Contributor
Posts: 223
Joined: Wed Jul 07, 2004 12:44 pm
Location: SF Bay Area

Why are the <td>s not next to each other?

Post by voltrader »

Code: Select all

<table class="verdana_grey_2" width="80%" align="center" cellspacing="0" cellpadding="0" border=1>
<tr>


	<td width="30%">
		<tr>
			<td>
				name
			</td>
		</tr>
		<tr>
			<td>
				<input type=text size=30 name="a" value="">
			</td>
		</tr>
	</td>

	
	<td width="30%">
		<tr>
			<td>
				number
			</td>
		</tr>
		<tr>
			<td>
				<input type=text size=20 name="b" value="">
			</td>
		</tr>
	</td>
	
	<td width="30%">
		<tr>
			<td>
				or select
			</td>
		</tr>
		<tr>
			<td>
				<select name='c'>
				<option>---</option>
				<option>1</option>
				<option>2</option>
				<option>3</option>
				<option>4</option>
				</select>
			</td>
		</tr>
	</td>
	
</tr>
</table>
Aim was to have 3 columns in table with "name", "number" and "or select" above two input boxes and drop-down, respectively.

For some reason, <td>s are wrapping to next row.

What's wrong here?
ldomingues
Forum Commoner
Posts: 41
Joined: Fri Aug 06, 2004 1:15 pm
Location: Portugal

Post by ldomingues »

You cannot use <TR> inside <TD>. If you want to use <TR>, you must create a complete table inside a <TD>.
User avatar
voltrader
Forum Contributor
Posts: 223
Joined: Wed Jul 07, 2004 12:44 pm
Location: SF Bay Area

Post by voltrader »

got it, thanks
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

generally, you should minimize the number of tables. Infact, while your at it, don't use them at all and get into using div's.. something I wish a long time ago :)
User avatar
nigma
DevNet Resident
Posts: 1094
Joined: Sat Jan 25, 2003 1:49 am

Post by nigma »

No phenom! You changed your avatar!
User avatar
phice
Moderator
Posts: 1416
Joined: Sat Apr 20, 2002 3:14 pm
Location: Dallas, TX
Contact:

Post by phice »

Phenom wrote:generally, you should minimize the number of tables. Infact, while your at it, don't use them at all and get into using div's.. something I wish a long time ago :)
Only if I can find a decent tutorial for people who always use tables that would like to convert to <div.
Image Image
Post Reply