<table>
<thead>
<tr>
<th>Name</th>
<th>Age</th>
<th>City</th>
</tr>
</thead>
<tbody>
<tr>
<td>Ko Min</td>
<td>25</td>
<td>Yangon</td>
</tr>
<tr>
<td>Ma Aye</td>
<td>22</td>
<td>Mandalay</td>
</tr>
</tbody>
</table>
| Name | Age | City |
|---|---|---|
| Ko Min | 25 | Yangon |
| Ma Aye | 22 | Mandalay |
<table> → Table container<thead> → Header group<tbody> → Body group<tfoot> → Footer group<tr> → Table Row<th> → Header Cell (bold, center)<td> → Data Cell
<!-- colspan: အလျားတိုး -->
<table border="1">
<tr>
<th colspan="3">
Full Name
</th>
</tr>
<tr>
<td>Title</td>
<td>First</td>
<td>Last</td>
</tr>
</table>
<!-- rowspan: အမြင့်တိုး -->
<table border="1">
<tr>
<td rowspan="2">
Merged
</td>
<td>Row 1</td>
</tr>
<tr>
<td>Row 2</td>
</tr>
</table>
colspan example:
| Full Name | ||
|---|---|---|
| Mr/Mrs | First Name | Last Name |
| Mr | Min | Aung |
rowspan example:
| Merged Cell | Row 1 Col 2 |
| Row 2 Col 2 |
<table>
<caption>💰 Monthly Sales Report</caption>
<thead>
<tr><th>Product</th><th>Qty</th><th>Price</th><th>Total</th></tr>
</thead>
<tbody>
<tr><td>Apple</td><td>10</td><td>500</td><td>5,000</td></tr>
<tr><td>Banana</td><td>5</td><td>300</td><td>1,500</td></tr>
</tbody>
<tfoot>
<tr><td colspan="3"><strong>Grand Total</strong></td><td>6,500</td></tr>
</tfoot>
</table>
| Product | Qty | Price (Ks) | Total (Ks) |
|---|---|---|---|
| Apple | 10 | 500 | 5,000 |
| Banana | 5 | 300 | 1,500 |
| Orange | 8 | 400 | 3,200 |
| Grand Total | 9,700 | ||
table {
border-collapse: collapse; /* border gaps ဖျက် */
width: 100%;
}
th, td {
border: 1px solid #ddd;
padding: 8px 12px;
text-align: left;
}
th {
background-color: #2c3e50;
color: white;
}
tr:nth-child(even) {
background-color: #f8f9fa; /* Zebra stripes */
}
tr:hover {
background-color: #fff3ee; /* Hover highlight */
}
← HTML 03 | Next: HTML Lesson 05 → Forms