I still unable to understand the use of 'colspan' in table, can anyone tell me please? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

I still unable to understand the use of 'colspan' in table, can anyone tell me please?

I'm confused how to use'colspan' in tables.

25th Feb 2018, 5:20 PM
Ibad Khan
Ibad Khan - avatar
3 Answers
+ 6
<table width="200" border="3" cellspacing="3" sellpadding="8" align="center"> <tr> <td colspan = "2" bgcolor="green">Flowers</td> </tr> <tr> <td>Rose</td> <td>Carnation</td> </tr> <tr> <td>Lily</td> <td>Chamomile</td> </tr> </table>
27th Feb 2018, 8:26 AM
masha
+ 10
Colspan is used to expand a column size to the specified unit. For example, if the value of colspan is 3, then the corresponding column will occupy space of 3 columns. Example code: https://code.sololearn.com/WMCtz6gWOqBD/?ref=app In the above example, the column under blue-green is taking space of 2 columns because its colspan is 2.
25th Feb 2018, 5:30 PM
Shamima Yasmin
Shamima Yasmin - avatar
+ 4
Attribute colspan combines the specified quantity into onе.  if you write a col of 2, then one cell will be like two, and if you write a colspan of 4, then like four.
27th Feb 2018, 8:25 AM
masha