HTML colspan Attribute
ความหมายและการใช้งาน
แอตทริบิวต์
colspan
กำหนดจำนวนคอลัมน์ที่เซลล์ตารางควรขยาย
นำไปใช้กับ
สามารถใช้ แอตทริบิวต์
colspan
กับองค์ประกอบต่อไปนี้:
องค์ประกอบ | คุณลักษณะ |
---|---|
<td> | โคลสแปน |
<th> | โคลสแปน |
ตัวอย่าง
ตัวอย่าง Td
ตาราง HTML ที่มีเซลล์ตารางที่ครอบคลุมสองคอลัมน์:
<table>
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
<tr>
<td>February</td>
<td>$100</td>
</tr>
<tr>
<td colspan="2">Sum: $180</td>
</tr>
</table>
Th ตัวอย่าง
ตาราง HTML ที่มีเซลล์ส่วนหัวที่ครอบคลุมสองคอลัมน์:
<table>
<tr>
<th colspan="2">Monthly Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
<tr>
<td>February</td>
<td>$80</td>
</tr>
</table>
รองรับเบราว์เซอร์
แอตทริบิวต์colspan
มีการสนับสนุนเบราว์เซอร์ต่อไปนี้สำหรับแต่ละองค์ประกอบ:
Element | |||||
---|---|---|---|---|---|
td | Yes | Yes | Yes | Yes | Yes |
th | Yes | Yes | Yes | Yes | Yes |