To create a table in HTML, you use the <table> element as the container for the table, and within that element you can use the <tr> element to create rows, and the <td> element to create cells within those rows. Each cell can contain text or other HTML elements.
Here is an example:<table> <tr> <td>Row 1, Cell 1</td> <td>Row 1, Cell 2</td> </tr> <tr> <td>Row 2, Cell 1</td> <td>Row 2, Cell 2</td> </tr> </table>
Some of the key elements that make up a table in HTML include:
- <table> : The container element for the table.
- <tr> : The container element for a table row.
- <td> : The container element for a table cell.
- <th> : The container element for a table header cell.
- <caption> : The container element for a table caption.
- <thead>, <tbody>, <tfoot> : These elements can be used to group rows in a table for formatting purposes.
- colspan and rowspan attributes : These attributes can be used to specify how many columns or rows a cell should span.
- scope attribute: It helps to make the table more accessible, by specifying the type of cells a header cell relates to.
- summary attribute: It provides a summary of the table's structure and purpose, which can be useful for people using screen readers.
Social Plugin