what is the purpose of colspan in this code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

what is the purpose of colspan in this code

<td colspan="2"><br /></td>

29th Apr 2020, 2:56 PM
Aadhisree 2821
Aadhisree 2821 - avatar
4 Answers
+ 5
colspan="n" means the column for which you have given this makes the size of the column to increase its size by n times the normal one.
29th Apr 2020, 3:18 PM
Puthur Harthik
+ 3
I never used that so yes i agree as that shifts those extras to right side thks for correcting me!
29th Apr 2020, 3:35 PM
Abhay
Abhay - avatar
+ 2
Abhay when we use colspan (same logic for rowspan) we must avoid the <td>s spanned: <table border="2px" height="300px" width="300px"> <tr> <td colspan="3"></td> </tr> <tr> <td></td> <td></td> <td></td> </tr> </table>
29th Apr 2020, 3:33 PM
visph
visph - avatar
+ 1
in your case it takes the space of next column for example : in below code it takes the space of next two columns and shifts them to right side,run this code and change the colspan so you can understand better <table border="2px" height="300px" width="300px"> <tr> <td colspan="3"></td> <td></td> <td></td> </tr> <tr> <td></td> <td></td> <td></td> </tr> </table>
29th Apr 2020, 3:04 PM
Abhay
Abhay - avatar