HTML Tables
Tables are mainly used for Tabular Data, and thats what they should be used for. You may come across a site that has a nice layout, after you find out it was created with tables, you get all excited and want to do this same thing. Before you design your web page with tables take a look at the CSS and Tables article.
So with keeping the above in mind, lets make some tables!
We will start off with the <table> tag, which is used to begin the table. Inside the table tag comes the <tr>, table rows, and the <td>, table column tags. Below is a simple table.
| Row 1 Cell 1 | Row 1 Cell 2 |
| Row 2 Cell 1 | Row 2 Cell 2 |
<tr><td>Row 1 Cell 1</td><td>Row 1 Cell 2</td></tr>
<tr><td>Row 2 Cell 1</td><td>Row 2 Cell 2</td></tr>
</table>
Cellpadding
The cellpadding attribute defines the distance between the borders of the cell.
<tr>
<th>Column 1</th>
<th>Column 2</th>
</tr>
<tr><td>Row 1 Cell 1</td><td>Row 1 Cell 2</td></tr>
<tr><td>Row 2 Cell 1</td><td>Row 2 Cell 2</td></tr>
</table>
In the above HTML code I added a padding of 15, so we can clearly see the difference, below is an example of the cellpadding.
| Column 1 | Column 2 |
|---|---|
| Row 1 Cell 1 | Row 1 Cell 2 |
| Row 2 Cell 1 | Row 2 Cell 2 |