Table cells that span more than one column:-
<html>
<head>
<style>
table, th, td {
border: 2px solid black;
border-collapse: collapse;
}
th, td {
padding: 4px;
text-align: left;
}
</style>
</head>
<body>
<h2>Cell that spans two columns</h2>
<p>To make a cell span more than one column, use the colspan attribute.</p>
<table style="width:100%">
<tr>
<th>Name</th>
<th colspan="2">Telephone</th>
</tr>
<tr>
<td>Akash Jaiswal</td>
<td>987 8866 528</td>
<td>987 8866 528</td>
</tr>
</table>
</body>
</html>
<html>
<head>
<style>
table, th, td {
border: 2px solid black;
border-collapse: collapse;
}
th, td {
padding: 4px;
text-align: left;
}
</style>
</head>
<body>
<h2>Cell that spans two columns</h2>
<p>To make a cell span more than one column, use the colspan attribute.</p>
<table style="width:100%">
<tr>
<th>Name</th>
<th colspan="2">Telephone</th>
</tr>
<tr>
<td>Akash Jaiswal</td>
<td>987 8866 528</td>
<td>987 8866 528</td>
</tr>
</table>
</body>
</html>
OUTPUT:-
No comments:
Post a Comment