HTML Tables
Tables in HTML are defined with the Table tag.
A table is divided into rows with the tr tag, which stands for table row, and each row is divided into data cells with the td tag, which stands for table data. A td tag can contain text, links, images, lists, forms, other tables, etc.
Ex:
No. | Name | Professional |
---|---|---|
1 | Sachin | Cricket |
2 | Lionel Messi | Football |
3 | Roger Federer | Tennis |
Table CellPadding and CellSpacing
The cellpadding and cellspacing attributes are used to adjust white space inside a table.
The cellpadding adjust the white space between table cell border and its content.
The cellspacing adjust the white space between table cells.
Ex:
No. | Name | Professional |
---|---|---|
1 | Sachin | Cricket |
Spanning Multiple Rows and Cells
Spanning allow you to extend columns and rows across multiple other columns and rows.
Normally, when we creating a table cell, it cannot pass over into the space below or above another table cell. But, you can use the colspan attribute to span multiple columns and rowspan attribute to span multiple rows in a table.
Ex:
Name Info | ||
---|---|---|
1 | Sachin | Cricket |
2 | Lionel Messi | Football |
Leave A Comment