HTML <caption> tag
HTML <caption> tag : Definition
• The HTML <caption> tag is used defines the caption (or <title>) of a table.
• The <caption> element should be the first child of its parent <table> element.
<caption> tag example :
<!DOCTYPE html> <html> <head> <style> table, th, td { border: 1px solid black; } </style> </head> <body> <h1>The caption element example</h1> <table> <caption>Monthly Incomes</caption> <tr> <th>Month</th> <th>income</th> </tr> <tr> <td>January</td> <td>$1200</td> </tr> <tr> <td>February</td> <td>$1250</td> </tr> </table> </body> </html>
OUTPUT :
The caption element example
Month | income |
---|---|
January | $1200 |
February | $1250 |