Tables
The table is the best way for representing data on the website. In HTML we can draw a table with the help of table group of tags. All important table tags are listed below.
- <table>: Table paired tag, contains following tags inside it.
- <th>: Table Header to add column name
- <tr>: Table Row for each row in table
- <td>: Table Data to put data in the cell
Apart from above-listed tags following are optional tags which are also used for better representation.
- <caption>: Adds a caption below the table
- <colgroup>: Colgroup helps in stating a group of columns
- <thead>: Defines head of the column
- <tbody>: Defines the body of the table and contains a set of rows
- <tfoot>: Mainly used for summarizing at end of the column
Important attributes accepted by <table >
- align: To align the table in a document.
- bgcolor: The background colour of a table.
- border: Size of the border surrounding table
- cellpadding: space between the content of a cell and its border
- cellspacing: space between two cells
- width: width of the table
Merge Cell
colspan:
HTML tag <td> accept colspan attribute to merge cell. The colspan attribute defines the number of columns a cell should span.
rowspan:
HTML tag <td> accept rowspan attribute to merge cell. The colspan attribute defines the number of rows a cell should span.