Home >>
HTML 5 >> What is Table Colspan and Rowspan in HTML 5
What is Table Colspan and Rowspan in HTML 5
HTML colspan attribute is used for specifies the number of columns a cell should span.
It allows the single table cell to span the width of more than one cell or column.
Note: colspan="2", 2 define number of "merge cell"
Example
<!Doctype Html>
<html>
<head>
<title>HTML table colspan</title>
</head>
<body>
<table width="200" height="200" border="1">
<tr>
<td>A</th>
<td>B</th>
</tr>
<tr>
<td>C</td>
<td>D</td>
</tr>
<tr>
<td colspan="2">E</td>
</tr>
</table>
</body>
</html>
HTML rowspan attribute is used for specifies the number of rows a cell should span.
It allows the single table cell to span the width of more than one cell or column.
Note: rowspan="2", 2 define number of "merge cell"
Example
<!Doctype Html>
<html>
<head>
<title>HTML table Rowspan</title>
</head>
<body>
<table width="200" height="200" border="1">
<tr>
<td>Name</th>
<td>Age</th>
</tr>
<tr>
<td>Ram</td>
<td rowspan="2">24</td>
</tr>
<tr>
<td>shyam</td>
</tr>
</table>
</body>
</html>
Post Your Comment