<table>: The HTML Table Element
1 Description
The HTML <table>
element is used
to create tables (obviously). <table>
elements
are made up of three parts; a table header (<thead>
),
a table body (<tbody>
) and a table footer
(<tfoot>
).
Each of these three elements contain table rows (<tr>
).
The table header (<thead>
) rows (<tr>
)
contain table header cells (<th>
).
The table body (<tbody>
) and table footer
(<tfoot>
) rows (<tr>
) contain table data
(<td>
) elements.
2 Elements
<!DOCTYPE html>
<html>
<head>
<title>Example Page</title>
</head>
<body>
<h1>Example HTML Page</h1>
<p>This is a sample table element.</p>
<table>
<thead>
<tr>
<th colspan="2">Appointments Scheduled</th>
</tr>
<tr>
<th>Day of the Week</th>
<th>Number of Appointments</th>
</tr>
</thead>
<tbody>
<tr>
<td>Sunday</td>
<td>0</td>
</tr>
<tr>
<td>Monday</td>
<td>16</td>
</tr>
<tr>
<td>Tuesday</td>
<td>9</td>
</tr>
<tr>
<td>Wednesday</td>
<td>10</td>
</tr>
<tr>
<td>Thursday</td>
<td>4</td>
</tr>
<tr>
<td>Friday</td>
<td>11</td>
</tr>
<tr>
<td>Saturday</td>
<td>18</td>
</tr>
</tbody>
<tfoot>
<tr>
<td>Total Appointments This Week</td>
<td>68</td>
</tr>
</tfoot>
</table>
</body>
</html>
This document was last updated: