HTML Tables Cheat Sheet

Table:

<table>
<tr>
<td>Column 1, Row 1</td>
<td>Column 2, Row 1</td>
<td>Column 3, Row 1</td>
</tr>
<tr>
<td>Column 1, Row 2</td>
<td>Column 2, Row 2</td>
<td>Column 3, Row 2</td>
</tr>
<tr>
<td>Column 1, Row 3</td>
<td>Column 2, Row 3</td>
<td>Column 3, Row 3</td>
</tr>
</table>
Column 1, Row 1 Column 2, Row 1 Column 3, Row 1
Column 1, Row 2 Column 2, Row 2 Column 3, Row 2
Column 1, Row 3 Column 2, Row 3 Column 3, Row 3



Table with row lines:

<table rules=rows>
<tr>
<td>Column 1, Row 1</td>
<td>Column 2, Row 1</td>
<td>Column 3, Row 1</td>
</tr>
<tr>
<td>Column 1, Row 2</td>
<td>Column 2, Row 2</td>
<td>Column 3, Row 2</td>
</tr>
<tr>
<td>Column 1, Row 3</td>
<td>Column 2, Row 3</td>
<td>Column 3, Row 3</td>
</tr>
</table>
Column 1, Row 1 Column 2, Row 1 Column 3, Row 1
Column 1, Row 2 Column 2, Row 2 Column 3, Row 2
Column 1, Row 3 Column 2, Row 3 Column 3, Row 3



Table with column lines:

<table rules=cols>
<tr>
<td>Column 1, Row 1</td>
<td>Column 2, Row 1</td>
<td>Column 3, Row 1</td>
</tr>
<tr>
<td>Column 1, Row 2</td>
<td>Column 2, Row 2</td>
<td>Column 3, Row 2</td>
</tr>
<tr>
<td>Column 1, Row 3</td>
<td>Column 2, Row 3</td>
<td>Column 3, Row 3</td>
</tr>
</table>
Column 1, Row 1 Column 2, Row 1 Column 3, Row 1
Column 1, Row 2 Column 2, Row 2 Column 3, Row 2
Column 1, Row 3 Column 2, Row 3 Column 3, Row 3



Table with row and column lines:

<table rules=all>
<tr>
<td>Column 1, Row 1</td>
<td>Column 2, Row 1</td>
<td>Column 3, Row 1</td>
</tr>
<tr>
<td>Column 1, Row 2</td>
<td>Column 2, Row 2</td>
<td>Column 3, Row 2</td>
</tr>
<tr>
<td>Column 1, Row 3</td>
<td>Column 2, Row 3</td>
<td>Column 3, Row 3</td>
</tr>
</table>
Column 1, Row 1 Column 2, Row 1 Column 3, Row 1
Column 1, Row 2 Column 2, Row 2 Column 3, Row 2
Column 1, Row 3 Column 2, Row 3 Column 3, Row 3



Table with padding:

<table cellpadding=10>
<tr>
<td>Column 1, Row 1</td>
<td>Column 2, Row 1</td>
<td>Column 3, Row 1</td>
</tr>
<tr>
<td>Column 1, Row 2</td>
<td>Column 2, Row 2</td>
<td>Column 3, Row 2</td>
</tr>
<tr>
<td>Column 1, Row 3</td>
<td>Column 2, Row 3</td>
<td>Column 3, Row 3</td>
</tr>
</table>
Column 1, Row 1 Column 2, Row 1 Column 3, Row 1
Column 1, Row 2 Column 2, Row 2 Column 3, Row 2
Column 1, Row 3 Column 2, Row 3 Column 3, Row 3



Table with everything:

<table rules=all>
<tr align=center>
<td><strong>Centered Column Heading 1</strong></td>
<td><strong>Centered Column Heading 2</strong></td>
<td><strong>Centered Column Heading 3</strong></td>
<td><strong>Centered Column Heading 4</strong></td>
</tr>
<tr>
<td><em>Italic table item</em></td>
<td><strong>Bold table item</strong></td>
<td align=right>Right aligned table item</td>
<td align=center>Centered table item</td>
</tr>
</table>
Centered Column Heading 1 Centered Column Heading 2 Centered Column Heading 3 Centered Column Heading 4
Italic table item Bold table item Right aligned table item Centered table item