ใช้แท็ก <tr> เพื่อเพิ่มแถวตาราง แท็ก HTML <tr> ใช้สำหรับระบุแถวตารางภายในตาราง
แอตทริบิวต์เพิ่มเติม (เลิกใช้งานแล้ว)
| แอตทริบิวต์ | ค่า | คำอธิบาย |
|---|---|---|
| Align | right, left, center, justify, char | Deprecated - การจัดตำแหน่งภาพ |
| bgcolor | rgb(x,x,x), #hexcode, colorname | Deprecated - ระบุสีพื้นหลังของเซลล์ตาราง |
| Char | Character | Deprecated - ระบุตัวอักษรสำหรับจัดตำแหน่ง ใช้เมื่อ align="char" |
| Charoff | pixels หรือ % | Deprecated - ระบุออฟเซ็ตการจัดตำแหน่ง ใช้เมื่อ align="char" |
| Valign | top, middle, bottom, baseline | Deprecated - การจัดตำแหน่งแนวตั้ง |
หมายเหตุ: แอตทริบิวต์เหล่านี้ Deprecated ใน HTML5 ควรใช้ CSS (text-align, background-color, vertical-align) แทน
ตัวอย่าง
คุณสามารถลองรันโค้ดต่อไปนี้เพื่อเรียนรู้วิธีเพิ่มแถวในตาราง HTML:
<!DOCTYPE html>
<html>
<head>
<title>HTML tr Tag</title>
</head>
<body>
<table border="1">
<tr>
<th>นักขว้างลูกโป่ง</th>
<th>อันดับ</th>
</tr>
<tr>
<td>วิรัต โกลี</td>
<td>1</td>
</tr>
<tr>
<td>เอบี เดอวิลเลียร์ส</td>
<td>2</td>
</tr>
</table>
</body>
</html>