+ 1
Please anyone give a code using rowspan?
4 Answers
+ 2
To use rowspan tag first create at least more than 2 rows using <tr> tag and then
in fist or second row in any cell <td rowspan="2">.... </td>
+ 1
Thanks buddy
0
@Himanshu Patel
That's wrong. You apply 'rowspan' to a cell (td), not a row (tr).
Here's some code that will showcase the use of both 'colspan' and 'rowspan':
<html>
<head>
<style>
table, th, td {
border: 1px solid black;
padding: 10px;
border-collapse:collapse;
}
</style>
</head>
<body>
<table>
<tr>
<th>Column 1 heading</th>
<th>Column 2 heading</th>
<th>Column 3 heading</th>
</tr>
<tr>
<td>Row 2, cell 1</td>
<td colspan="2">Row 2, cell 2, also spanning Row 2, cell 3</td>
</tr>
<tr>
<td rowspan="2">Row 3, cell 1, also spanning Row 4, cell 1</td>
<td>Row 3, cell 2</td>
<td>Row 3, cell 3</td>
</tr>
<tr>
<td>Row 4, cell 2</td>
<td>Row 4, cell 3</td>
</tr>
</table>
</body>
</html>
- 3
<body>
<table>
<tr rowspan="2">
<td>red</td>
<td>blue</td>
</tr>