แอตทริบิวต์ช่วง HTML
ความหมายและการใช้งาน
แอตทริบิวต์span
กำหนดจำนวนคอลัมน์
<col>
หรือ<colgroup>
องค์ประกอบควรขยาย
นำไปใช้กับ
สามารถใช้ แอตทริบิวต์span
กับองค์ประกอบต่อไปนี้:
องค์ประกอบ | คุณลักษณะ |
---|---|
<col> | สแปน |
<colgroup> | สแปน |
ตัวอย่าง
ตัวอย่าง Col
ในที่นี้ สองคอลัมน์แรกควรมีสีพื้นหลังเป็นสีแดง:
<table>
<colgroup>
<col span="2" style="background-color:red">
<col style="background-color:yellow">
</colgroup>
<tr>
<th>ISBN</th>
<th>Title</th>
<th>Price</th>
</tr>
<tr>
<td>3476896</td>
<td>My first HTML</td>
<td>$53</td>
</tr>
</table>
ตัวอย่างคอลกรุ๊ป
ตั้งค่าสีพื้นหลังของสองคอลัมน์แรกโดยใช้แอตทริบิวต์ span <colgroup>:
<table>
<colgroup span="2" style="background:red"></colgroup>
<tr>
<th>ISBN</th>
<th>Title</th>
<th>Price</th>
</tr>
<tr>
<td>3476896</td>
<td>My first HTML</td>
<td>$53</td>
</tr>
<tr>
<td>5869207</td>
<td>My first CSS</td>
<td>$49</td>
</tr>
</table>
รองรับเบราว์เซอร์
แอตทริบิวต์span
มีการสนับสนุนเบราว์เซอร์ต่อไปนี้สำหรับแต่ละองค์ประกอบ:
Element | |||||
---|---|---|---|---|---|
col | Yes | Yes | Yes | Yes | Yes |
colgroup | Yes | Yes | Yes | Yes | Yes |