A table with left-aligned headings:-
<html>
<head>
<style>
table, th, td {
border: 2px solid black;
border-collapse: collapse;
}
th, td {
padding: 5px;
}
th {
text-align: left;
}
</style>
</head>
<body>
<h2>Left-align Headings</h2>
<p>To left-align the table headings, use the CSS text-align property.</p>
<table style="width:100%">
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
</tr>
<tr>
<td>Akash</td>
<td>Jaiswal</td>
<td>20</td>
</tr>
<tr>
<td>Ansh</td>
<td>Rana</td>
<td>24</td>
</tr>
<tr>
<td>Jordan</td>
<td>Singh</td>
<td>28</td>
</tr>
</table>
</body>
</html>
OUTPUT:-
<html>
<head>
<style>
table, th, td {
border: 2px solid black;
border-collapse: collapse;
}
th, td {
padding: 5px;
}
th {
text-align: left;
}
</style>
</head>
<body>
<h2>Left-align Headings</h2>
<p>To left-align the table headings, use the CSS text-align property.</p>
<table style="width:100%">
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
</tr>
<tr>
<td>Akash</td>
<td>Jaiswal</td>
<td>20</td>
</tr>
<tr>
<td>Ansh</td>
<td>Rana</td>
<td>24</td>
</tr>
<tr>
<td>Jordan</td>
<td>Singh</td>
<td>28</td>
</tr>
</table>
</body>
</html>
OUTPUT:-
- To left-align the table headings, use the CSS text-align property.
No comments:
Post a Comment