Continue

 Table Header, Body, and Footer

Tables can be divided into three portions: a header, a body, and a foot. The head and foot are rather similar to headers and footers in a word-processed document that remain the same for every page, while the body is the main content holder of the table. 

The three elements for separating the head, body, and foot of a table are:

<thead>-to create a separate table header.

<tbody> to indicate the main body of the table.

<tfoot> to create a separate table footer.

A table may contain several <tbody> elements to indicate different pages or groups of data. But it is notable that <thead> and <tfoot> tags should appear before <tbody>

Example

<!DOCTYPE html>

<html>

<head>

<title>HTML Table</title>

</head>

<body>

<table border="1" width="100%">

<thead>

<tr>

<td colspan="4">This is the head of the table</td>

</tr>

</thead>

<tfoot>

<tr>

<td colspan="4">This is the foot of the table</td>

</tr>

</tfoot>

<tr>

<td>Cell 1</td><td>Cell 2</td><td>Cell 3</td><td Cell 4</td>

</tr>

</tbody>

</table>

</body>

</html>

This will produce the following result:

Comments

Popular Posts