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>
  
Click to view this demo.
Home 
  HTML CSS Book 
    HTML  

table tr td:
  1. <table>,<tr>,<td> creates a simple table
  2. Adding a Caption to a Table
  3. Add Borders to the table
Related: