2. HTML Tables
Tables organize data into
rows
and
columns
.
Commonly used for:
Student Marks
Schedules
Product Lists
Price Tables
<table>
Creates the table
<tr>
Defines a table row
<th>
Table header (bold/center)
<td>
Table data (regular cell)
Table Syntax & Rules
<table>
<tr>
<th>Header</th>
</tr>
<tr>
<td>Data</td>
</tr>
</table>
Table Rules:
Table contains rows (tr)
Rows define cells (th/td)
Note:
Tables should only be used for tabular data, not for page layouts.
Student Marks Example
<table border="1">
<tr>
<th>Name</th>
<th>Marks</th>
</tr>
<tr>
<td>Rahul</td>
<td>90</td>
</tr>
</table>
Rendered Output:
Name
Subject
Marks
Rahul
Math
90
Priya
Science
85
Previous
Next