what is caption tag in html
Syntax
Syntax of HTML <summary> tag
<caption>.......</caption>
<caption>.......</caption>
what is caption tag in html
Example
<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
border: 1px solid black;
}
</style>
</head>
<body>
<table>
<tr>
<th>Name</th>
<th>class</th>
</tr>
<tr>
<td>Radha</td>
</tr>
<tr>
<td>Seeta</td>
</tr>
</table>
</body>
</html>
Explain Program
Step 1]
<!DOCTYPE html>
- This declare the document type.
- browser that the document is written in html
Step 2 ]
<html>.... . </html>
- html is the root element of the html page.
- Every thing inside it is part of the webpage.
Step 3]
<head>
<title> HTML iframe tag </title>
<style>
table, th, td {
border: 1px solid black;
}
</style>
</head>
- <head> section
- head section contains metadata about page. not visible on the page itself.
- <title> tag title section set the title of the page shows the browser tab.
CSS Styling directly in HTML.
- 1px solid black border.
- <table> :- table
- <th> :- table headers
- <td> : - table data cells
Step 4]
- <body> body contains the visible content webpage.
- html <h1> tag heading
Step 4]
<table>
<caption>Monthly savings</caption>
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
<tr>
<td>February</td>
<td>$50</td>
</tr>
</table>
<table>
- html <table> tag define table.
- table tag all row(<tr>) and cells ( <th> or <td> ) inside table tag.
<caption>Monthly savings</caption>
- html <caption> tag title description for table.
- browser display above table.
Step 5]
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
- <tr> :- table row.
- <th> :- table header cell.
- <th> tag use data bold and centered.
- row is header row for table column.
Step 6]
<tr>
<td>January</td>
<td>$100</td>
</tr>
<tr>
<td>February</td>
<td>$50</td>
</tr>
- html <tr> tag :- represents a row of data.
- html <td> tag :- table data cell .
Step 7]
closing the Tag
</table>
</body>
</html>
