+ 1
Why colspan is used in html tables??
2 Answers
+ 4
'colspan' is used to set the number of cells IN A ROW to merge...
'rowspan' is used as well to set number of cells merged in a column...
Merged cells don't have to be write in the code:
<table>
<tr>
<td>cell content</td>
<td colspan="2">cell content</td>
<td>cell content</td>
<!-- only 3 td elements, but virtually 4 -->
</tr>
<tr>
<!-- in a row without merged cells, we need as much td element than virtual number in rows with merged cells -->
<td>cell content</td>
<td>cell content</td>
<td>cell content</td>
<td>cell content</td>
</tr>
<!-- same rule applied in case of rowspan, but virtual cells are in column -->
</table>
0
colspan attribute is used to expand a cell for two or more cells