HTML

HOW TO CREATE HTML TABLES

(a quick guide)

<table> The table itself. <tr> Table row. <th> Header cell. <td> table cell.

BASIC HTML TABLE

01

<table>   <tr>     <th>HEAD</th> <th>HEAD</th>   </tr>   <tr>     <td>CELL</td> <td>CELL</td>   </tr> </table>

HEAD BODY FOOT SECTIONING

02

<table>   HEADER   <thead><tr>     <th>HEAD</th> <th>HEAD</th>   </tr></thead>   BODY   <tbody><tr>

    <td>CELL</td> <td>CELL</td>   </tr></tbody>   FOOTER   <tfoot><tr>     <td>CELL</td> <td>CELL</td>   </tr></tfoot> </table>

COLUMN GROUPS

03

<table>   COLUMN GROUPS   <colgroup>     <col span="2" style="background:red">     <col style="background:blue">   </colgroup>

  <tr>     <td>RED</td> <td>RED</td>     <td>BLUE</td>   </tr> </table>

ROW & COLUMN SPAN ON CELLS

04

<table>   <tr>     <td rowspan="2">2 ROWS</td>     <td colspan="2">2 COLUMNS</td>   </tr> </table>