+ 1

Why colspan is used in html tables??

25th Jul 2017, 9:52 AM
Shubhadip Chattaraj
Shubhadip Chattaraj - avatar
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>
25th Jul 2017, 10:52 AM
visph - avatar
colspan attribute is used to expand a cell for two or more cells
25th Jul 2017, 9:55 AM
Shubhadip Chattaraj
Shubhadip Chattaraj - avatar