+ 1

Help me understand the tables in html

Help me understand the tables in html

8th Mar 2021, 4:30 PM
Bert
2 ответов
+ 3
This is a table: <table> </table> If you want to add a row to the table you can do this like that: <table> <tr> </tr> </table> If you want to add a column inside this row you can do this like that: <table> <tr> <td></td> </tr> </table> There are two attributes called rowspan and colspan, how do they work? They can be used if for example you want a single column to take two (or more) table cells vertically or horizontally. For example, lets make a table, in which the second row has three table columns but the first row has only two, since the second row has three columns, there will be a white empty space left at the first row, to fix that we can make the second td of the first row to take 2 column cells: <table> <tr> <td></td> <td colspan="2"></td> </tr> <tr> <td></td> <td></td> <td></td> </tr> </table> Rowspan works similarly: <table> <tr> <td></td> <td rowspan="2"></td> </tr> <tr> <td></td> </tr> </table> This would create a table with two rows, in which the second column would take two row cells.
8th Mar 2021, 5:37 PM
Karak10
Karak10 - avatar
0
Karak10 you also have to give "border" attribute to <table> otherwise, without styling, it'll not be shown.
9th Mar 2021, 4:57 AM
Samin Sakur
Samin Sakur - avatar