Topic: Table columns (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=24263" title="Pages that link to Topic: Table columns (Page 1 of 1)" rel="nofollow" >Topic: Table columns <span class="small">(Page 1 of 1)</span>\

 
AlterEgo
Bipolar (III) Inmate

From:
Insane since: Jul 2004

posted posted 12-01-2004 22:26

Ok, I'm new to HTML and this is probably a really easy problem, but anyway. I'm trying to make a table of one column and four rows but the HTML below puts it all in one row and four columns. I don't really understand the difference between <td> and <tr> which is probably where the problem is. Anyway the source code is below:

<table border="6" cellpadding="0" cellspacing="0">
<td><font face="verdana">col 1 line 1</font></td>
<td><font face="verdana">col 1 line 2</font></td>
<td><font face="verdana">col 1 line 3</font></td>
<td><font face="verdana">col 1 line 4</font></td>
</table>

edit: removed preformatting tags after realising it's preformatted anyway

(Edited by AlterEgo on 12-01-2004 22:27)

hyperbole
Paranoid (IV) Inmate

From: Madison, Indiana, USA
Insane since: Aug 2000

posted posted 12-02-2004 18:39
quote:
I don't really understand the difference between <td> and <tr> which is probably where the problem is.



Yes that's where the problem lies. You need to understand the difference.

<tr> ... </tr> specifies a row in a table.
<td> ... </td> speciifes an element (or column) in a row.

You have created a table with four column tags and since you have not specified a row tag, the browser assumes that all the column elements are in a single row.

The correct way to have coded this would be

code:
<table border="6" cellpadding="0" cellspacing="0">
<tr>
<td><font face="verdana">col 1 line 1</font></td>
<td><font face="verdana">col 1 line 2</font></td>
<td><font face="verdana">col 1 line 3</font></td>
<td><font face="verdana">col 1 line 4</font></td>
</tr>
</table>




To create a table with four rows and one column use

code:
<table border="6" cellpadding="0" cellspacing="0">
<tr><td><font face="verdana">col 1 line 1</font></td></tr>
<tr><td><font face="verdana">col 1 line 2</font></td></tr>
<tr><td><font face="verdana">col 1 line 3</font></td></tr>
<tr><td><font face="verdana">col 1 line 4</font></td></tr>
</table>





.

-- not necessarily stoned... just beautiful.



Post Reply
 
Your User Name:
Your Password:
Login Options:
 
Your Text:
Loading...
Options:


« BackwardsOnwards »

Show Forum Drop Down Menu