What is ["colspan = "2"]? ooooo .... O.o! ! ! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
12th May 2018, 11:21 AM
Vučko/Вучко/Vuchko
Vučko/Вучко/Vuchko - avatar
7 Answers
+ 22
Thanks for the answer but I do not see the difference, see if you look at the code! <table border="2"> <tr> <td>Red</td> <td>Blue</td> <td>Green</td> </tr> <tr> <td><br /></td> <td colspan="3"><br /></td> </tr> </table>
12th May 2018, 12:05 PM
Vučko/Вучко/Vuchko
Vučko/Вучко/Vuchko - avatar
+ 12
The colspan attribute defines the number of columns a table cell should span. In your case, two columns. Explanation and examples: https://www.w3schools.com/Tags/att_colspan.asp
12th May 2018, 11:29 AM
NezhnyjVampir
+ 10
Vučko/Вучко/Vuchko, perhaps this code will help you to see the difference😊 https://code.sololearn.com/Wqeb7b7rgcUj/?ref=app
12th May 2018, 12:33 PM
NezhnyjVampir
+ 6
Table cells can span across more than one column or row. The attributes COLSPAN (“how many across”) and ROWSPAN (“how many down”) indicate how many columns or rows a cell should take up Read more: https://html.com/attributes/td-colspan/#ixzz5FHoMN4TJ
12th May 2018, 11:33 AM
MsJ
MsJ - avatar
+ 3
Vuchko, you cannot see the difference because your table only has 3 columns in total. Colspan defines the maximum number of columns the entry can cross. If you only have 2 columns and define colspan="3", than the entry will only be 2 wide, not 3. Perhaps you can see better with this: <table border="2" width="100%"> <tr> <td>Red</td> <td>Blue</td> <td>Green</td> <td>4th column</td> </tr> <tr> <td><br /></td> <td colspan="3">3 columns across</td> </tr> <tr> <td></td> <td colspan="2">only 2 columns across</td> <td></td> </tr> </table>
21st May 2018, 8:37 PM
Betty
0
It means the column should cover extra column by one flow
9th Nov 2018, 8:31 AM
Odai Daniel
Odai Daniel - avatar
0
It merges two columns in a table
5th Jan 2019, 2:59 AM
David Saah
David Saah - avatar