What are HTML Tables?
Tables are defined with the <table> tag .
- A table is divided into rows and columns.
- Each table row is using the <tr> tag and must be enclosed in </tr>tags
- Each table row is divided into data cells (using the <td> tag ).
- Td stands for “data table” and is the contents of a data cell.
- A data cell can contain text, images, lists, paragraphs, forms, horizontal lines, tables, and so on.
Example of Html Table
<!DOCTYPE html> <html> <body> <h2>Html Table</h2> <table style="width:100%"> <tr> <td>Apple</td> <td>Mango</td> </tr> <tr> <td>16</td> <td>14</td> </tr> <tr> <td>26</td> <td>34</td> </tr> </table> </body> </html>
Output
Html Table
Apple | Mango |
16 | 14 |
26 | 34 |
HTML Table Tags
<table>Describes a table.
<th>Describes a table header cell.
<tr>Represents a table row.
<td>Represents a cell in the table.
<captation>Defines a field associated with the table for entering an explanation.
<colgroup>Defines groups of columns in the table.
<col>Characterizes attribute values for one or more columns in a table.
<thead>Describes a table header that will not scroll.
<tbody>Defines the body of a table that unfolds inside a fixed table header and the footer of the table.
<tfoot>Represents a table footer that will not scroll.