Saturday, June 3, 2017

Colspan and Rowspan Attributes

colspan attribute if you want to merge two or more columns into a single column. Similar way you will use rowspan if you want to merge two or more rows.The following HTML table will be displayed with borders around the table cells:

<!DOCTYPE html>

<html>

<head>

<title>HTML 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></tr>

</table>

</body>


</html>

No comments:

Post a Comment