HTML tables are used to display data in rows and columns. They help organize information in a clear and structured format, making it easier to read and compare data.
What is a Table in HTML
A table in HTML is created using the <table> tag. Inside a table, data is arranged in rows and columns.
Basic Structure of a Table
An HTML table is made up of different parts like rows, headers, and data cells.
Table Tag
The <table> tag is used to create a table.
Example of Table Structure
<table> </table>
Table Row
The <tr> tag is used to create a row in a table.
Example of Table Row
<tr> </tr>
Table Header
The <th> tag is used for table headings. It is usually bold and centered by default.
Example of Table Header
<th>Name</th>
Table Data Cell
The <td> tag is used to add data inside a table.
Example of Table Data
<td>Ali</td>
Complete Table Structure Example
<table> <tr> <th>Name</th> <th>Age</th> </tr> <tr> <td>Ali</td> <td>20</td> </tr> </table>
How Tables Work
Each table starts with the <table> tag. Inside it, rows are created using <tr>. Each row contains headings (<th>) or data (<td>).
Summary
HTML table structure is used to organize data in rows and columns using <table>, <tr>, <th>, and <td> tags.