how do i make html tables?

  • Thread starter Thread starter Cesar G
  • Start date Start date
tables are pretty easy. Here is a basic one row one column table

<table>
<tr><td></td></tr>
</table>

the <table> elements begina nd end your table
the <tr> means TABLE ROW which begins and ends your row
the <td> means TABLE DATA which is where you put the content. It is also the columns.

they are basically containers.. and the <td> </td> is always where you will put the content. You can use things like "colspan" to make a column span across multiple rows like this:

<table>
<tr colspan="2"><td></td></tr>
<tr><td></td><td></td></tr>
</table>
that is a table with two rows. In the first row there is just one cell that goes from one end to another. The second row is two separate cells.

You can get a complete explaination on creating tables, doing nice borders, and using the attributes to create more unique tables here:
 
<html>
<body bgcolor="yellow">
<font size=4 face="verdanta">
<table border="1" bgcolor="#007799" width="34%">
<tr>
<td>cell1</td>
<td>cell 2 </td>
</tr>
<tr>
<table border="1" bgcolor="#007700" width="22">
<td>another one</td>
<td>one more</td>
</tr>
</table>
</body>
</html>

add color,font and change its size by % or # pixels
 
<table>

<tr>
<td>This is column 1 in the first row</td>
<td>This is column 2 in the first row</td>
</tr>

<tr>
<td>This is column 1 in the second row</td>
<td>This is column 2 in the second row</td>
</tr>

</table>

---
You can use CSS to style and position your table in many ways.
 
<table> -- table start tag
<tr> -- creates a row
<td></td> -- this is a column..
<td></td> -- this is another column in that same row
<td></td> -- and so on....
</tr> -- ends that row
<tr>
<td>This is where the content goes in a cell</td>
<td>cell #2 from the left on the second row here</td>
<td>isn't this fun?</td>
</tr> -- finish the second row
</table> -- close the table tag


That's it! there's a number of other properties your table can have, but that is a generic table.
 
Back
Top