Basic HTML Table Structure
Tables in HTML are used to organize and display data in a structured format using rows and columns. The basic structure of an HTML table includes the following elements:
<table>: This tag defines the start and end of the table.<thead>: This section contains the header row(s) of the table, typically used for column titles.<tbody>: This section contains the main body of the table, where the actual data rows are placed.<tfoot>: This section contains the footer row(s) of the table, often used for summary information or totals.<tr>: This tag defines a table row. It is used within<thead>,<tbody>, and<tfoot>to create rows.<th>: This tag defines a header cell within a row. It is typically used in the first row of the table to label columns.<td>: This tag defines a standard data cell within a row. It is used to hold the actual data in the table.
Example of a basic HTML table structure:
Student Marksheet Example
| Student | Math | Science | English | Total |
|---|---|---|---|---|
| Alex | 88 | 92 | 85 | 265 |
| Jordan | 76 | 81 | 90 | 247 |
| Average | 256 | |||
Timetable Example
| Time Table | |||||
|---|---|---|---|---|---|
| Hours | Monday | Tuesday | Wednesday | Thursday | Friday |
| Science | Maths | Science | Maths | Arts | |
| Science | Maths | Science | Maths | Arts | |
| Lunch | |||||
| Science | Maths | Science | Maths | Project | |
| Science | Maths | Science | Maths | ||