Adding a Caption to a Table
The caption element marks a caption and associates it with a table element. A table can contain only one caption element. It doesn't have to be the first element contained in the table.
<!DOCTYPE HTML>
<html>
<head>
<title>Example</title>
</head>
<body>
<table>
<caption>This is the caption</caption>
<thead>
<tr>
<th>Column Header</th><th>Column Header</th><th>Column Header</th><th>Column Header</th>
</tr>
</thead>
<tbody>
<tr>
<th>Row Header:</th><td>A</td><td>B</td><td>C</td>
</tr>
<tr>
<th>Row Header:</th><td>A</td><td>B</td><td>C</td>
</tr>
<tr>
<th>Row Header:</th><td>A</td><td>B</td><td>C</td>
</tr>
</tbody>
</table>
</body>
</html>
Home
HTML CSS Book
HTML
HTML CSS Book
HTML
table tr td:
- <table>,<tr>,<td> creates a simple table
- Adding a Caption to a Table
- Add Borders to the table
Related: