Table Tutorial

Basic Structure

All tables require at least three tags: <table>, <tr>, and <td> (in that order).

Start with your <table> opening and closing tags.

<table></table>

To add a row, add a <tr> and </tr> after <table>.

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

To add a column, add a <td> and </td> after <tr>. Columns must be inside the rows.

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

Your text and other content must go inside the <td> and </td> tags.

Table Example

First Row 1, Column 1First Row 1, Column 2
Second Row 1, Column 1Second Row 1, Column 2
Third Row 1, Column 1Third Row 1, Column 2
<table>
    <tr>
        <td>First Row 1, Column 1</td>
        <td>First Row 1, Column 2</td>
    </tr>
    <tr>
        <td>Second Row 1, Column 1</td>
        <td>Second Row 1, Column 2</td>
    </tr>
    <tr>
        <td>Third Row 1, Column 1</td>
        <td>Third Row 1, Column 2</td>
    </tr>
</table>

Style

You can add specifications for the table or certain rows or columns. Add any of the following codes into the <table>, <tr>, or <td> tags.

border="2"
Border width.
bordercolor="#000000"
Border colour.
width="100%"
Width.
height="50"
Height.
bgcolor="#FFFFFF"
Background colour.
background="URLHERE"
Background image.
cellspacing="2"
Padding outside cell.
cellpadding="2"
Padding inside cell.