ข้อมูลอ้างอิงHTML

HTML โดยตัวอักษร HTML ตามหมวดหมู่ รองรับ HTML Browser แอตทริบิวต์ HTML HTML Global Attributes เหตุการณ์ HTML HTML สี HTML Canvas HTML เสียง/วิดีโอ ชุดอักขระ HTML HTML Doctypes การเข้ารหัส URL HTML รหัสภาษา HTML รหัสประเทศ HTML ข้อความ HTTP วิธี HTTP ตัวแปลง PX เป็น EM แป้นพิมพ์ลัด


HTML <th> คุณสมบัติcolspan

❮ แท็ก HTML <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กำหนดจำนวนคอลัมน์ที่เซลล์ส่วนหัวควรขยาย


รองรับเบราว์เซอร์

Attribute
colspan Yes Yes Yes Yes Yes

หมายเหตุ:เฉพาะ Firefox เท่านั้นที่รองรับcolspan="0"ซึ่งมีความหมายพิเศษ (ดูด้านล่างในตาราง "ค่าแอตทริบิวต์")


ไวยากรณ์

<th colspan="number">

ค่าแอตทริบิวต์

Value Description
number Sets the number of columns a header cell should span. Note: colspan="0" tells the browser to span the cell to the last column of the column group (colgroup)

❮ แท็ก HTML <th>