A table with a caption:-
<html>
<head>
<style>
table, th, td {
border: 2px solid black;
border-collapse: collapse;
}
th, td {
padding: 5px;
text-align: left;
}
</style>
</head>
<body>
<h2>Table Caption</h2>
<p>To add a caption to a table, use the caption tag.</p>
<table style="width:100%">
<caption>Car Price</caption>
<tr>
<tr>
<th>Car</th>
<th>Price</th>
</tr>
<tr>
<td>Maruti</td>
<td>$860</td>
</tr>
<tr>
<td>Fortuner</td>
<td>$1000</td>
</tr>
</table>
</body>
</html>
OUTPUT:-
<html>
<head>
<style>
table, th, td {
border: 2px solid black;
border-collapse: collapse;
}
th, td {
padding: 5px;
text-align: left;
}
</style>
</head>
<body>
<h2>Table Caption</h2>
<p>To add a caption to a table, use the caption tag.</p>
<table style="width:100%">
<caption>Car Price</caption>
<tr>
<tr>
<th>Car</th>
<th>Price</th>
</tr>
<tr>
<td>Maruti</td>
<td>$860</td>
</tr>
<tr>
<td>Fortuner</td>
<td>$1000</td>
</tr>
</table>
</body>
</html>
OUTPUT:-
No comments:
Post a Comment