HTML – Table Colspan and Rowspan

Previous
Next

Table Colspan and Rowspan:

  • These are used to merge cells in table.
  • Colspan is used to merge the columns in the table.
  • Rowspan is used to merge rows.
<!DOCTYPE html>
<html>
	<head><title>Table Colspan/Rowspan</title></head>

	<body>
		<table border="1">
			<tr>
				<th>Column 1</th>
				<th>Column 2</th>
				<th>Column 3</th>
			</tr>

			<tr>
				<td rowspan="2">Row 1 Cell 1</td>
				<td>Row 1 Cell 2</td>
				<td>Row 1 Cell 3</td>
			</tr>
			
			<tr>
				<td>Row 2 Cell 2</td>
				<td>Row 2 Cell 3</td>
			</tr>
				
			<tr>
				<td colspan="3">Row 3 Cell 1</td>
				<td>Row 3 Cell 2</td>
				<td>Row 3 Cell 3</td>
			</tr>

			<tr>
				<td>Row 4 Cell 1</td>
				<td>Row 4 Cell 2</td>
			</tr>
		</table>
	</body>
</html>
Previous
Next

Courses Enquiry Form