HTML Tables
HTML Tables
HTML tables are used to display data in rows and columns. A table is created using the <table> tag.
-
<tr>→ Table Row -
<th>→ Table Header (bold and centered by default) -
<td>→ Table Data (regular cell content)
Basic Table Example
Output Preview
| Name | Subject | Score |
|---|---|---|
| John | Math | 95 |
| Jane | Science | 88 |
Additional Table Attributes
| Attribute | Purpose |
|---|---|
border |
Adds border to table |
cellpadding |
Space between cell content and cell border |
cellspacing |
Space between cells |
width |
Sets table width |
align |
Aligns table (left, center, right) |
Tables help organize data clearly and are useful for reports, schedules, and lists on web pages.
