แอตทริบิวต์ colspan ใน HTML ใช้เพื่อกำหนดจำนวนคอลัมน์ที่เซลล์ควรขยายในตาราง ใช้แอตทริบิวต์ colspan บนองค์ประกอบ
แอตทริบิวต์ colspan องค์ประกอบ
แอตทริบิวต์ colspan ขององค์ประกอบ
ใน HTML กำหนดจำนวนคอลัมน์ที่เซลล์ควรขยาย
ต่อไปนี้เป็นไวยากรณ์ -
<td colspan="num">
ด้านบน num คือจำนวนคอลัมน์ที่เซลล์ควรขยาย ให้เราดูตัวอย่างการใช้แอตทริบิวต์ colspan ขององค์ประกอบ
- ตัวอย่าง
<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
border: 2px solid blue;
}
</style>
</head>
<body>
<h2>Product Expenses</h2>
<table>
<tr>
<th>Domains</th>
<th>Cost</th>
</tr>
<tr>
<td>Product Development</td>
<td>500000</td>
</tr>
<tr>
<td>Marketing</td>
<td>500000</td>
</tr>
<tr>
<td>Services</td>
<td>100000</td>
</tr>
<tr>
<td>Support</td>
<td>100000</td>
</tr>
<tr>
<td>Maintenance</td>
<td>100000</td>
</tr>
<tr>
<td colspan="2">Total Budget = INR 1300000</td>
</tr>
</table>
</body>
</html> ผลลัพธ์

แอตทริบิวต์ colspan องค์ประกอบ
แอตทริบิวต์ colspan ขององค์ประกอบ
ใช้เพื่อกำหนดจำนวนคอลัมน์ที่เซลล์ส่วนหัวควรขยาย
ต่อไปนี้เป็นไวยากรณ์ -
<th colspan="num">
ด้านบน num คือจำนวนคอลัมน์ที่เซลล์ส่วนหัวควรขยาย
ให้เราดูตัวอย่างการใช้แอตทริบิวต์ colspan ขององค์ประกอบ
- ตัวอย่าง
<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
border: 2px solid green;
}
</style>
</head>
<body>
<h2>Product Expenses</h2>
<table>
<tr>
<th colspan="2">Expenses</th>
</tr>
<tr>
<td>Product Development</td>
<td>500000</td>
</tr>
<tr>
<td>Marketing</td>
<td>500000</td>
</tr>
<tr>
<td>Services</td>
<td>100000</td>
</tr>
<tr>
<td>Support</td>
<td>100000</td>
</tr>
<tr>
<td>Maintenance</td>
<td>100000</td>
</tr>
<tr>
<td colspan="2">Total Budget = INR 1300000</td>
</tr>
</table>
</body>
</html> ผลลัพธ์

-
-
-
-
แอตทริบิวต์ colspan ขององค์ประกอบ
ต่อไปนี้เป็นไวยากรณ์ -
<td colspan="num">
ด้านบน num คือจำนวนคอลัมน์ที่เซลล์ควรขยาย ให้เราดูตัวอย่างการใช้แอตทริบิวต์ colspan ขององค์ประกอบ
ตัวอย่าง
<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
border: 2px solid blue;
}
</style>
</head>
<body>
<h2>Product Expenses</h2>
<table>
<tr>
<th>Domains</th>
<th>Cost</th>
</tr>
<tr>
<td>Product Development</td>
<td>500000</td>
</tr>
<tr>
<td>Marketing</td>
<td>500000</td>
</tr>
<tr>
<td>Services</td>
<td>100000</td>
</tr>
<tr>
<td>Support</td>
<td>100000</td>
</tr>
<tr>
<td>Maintenance</td>
<td>100000</td>
</tr>
<tr>
<td colspan="2">Total Budget = INR 1300000</td>
</tr>
</table>
</body>
</html> ผลลัพธ์

แอตทริบิวต์ colspan องค์ประกอบ
แอตทริบิวต์ colspan ขององค์ประกอบ
ใช้เพื่อกำหนดจำนวนคอลัมน์ที่เซลล์ส่วนหัวควรขยาย
ต่อไปนี้เป็นไวยากรณ์ -
<th colspan="num">
ด้านบน num คือจำนวนคอลัมน์ที่เซลล์ส่วนหัวควรขยาย
ให้เราดูตัวอย่างการใช้แอตทริบิวต์ colspan ขององค์ประกอบ
- ตัวอย่าง
<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
border: 2px solid green;
}
</style>
</head>
<body>
<h2>Product Expenses</h2>
<table>
<tr>
<th colspan="2">Expenses</th>
</tr>
<tr>
<td>Product Development</td>
<td>500000</td>
</tr>
<tr>
<td>Marketing</td>
<td>500000</td>
</tr>
<tr>
<td>Services</td>
<td>100000</td>
</tr>
<tr>
<td>Support</td>
<td>100000</td>
</tr>
<tr>
<td>Maintenance</td>
<td>100000</td>
</tr>
<tr>
<td colspan="2">Total Budget = INR 1300000</td>
</tr>
</table>
</body>
</html> ผลลัพธ์

-
-
-
-
แอตทริบิวต์ colspan ขององค์ประกอบ
ต่อไปนี้เป็นไวยากรณ์ -
<th colspan="num">
ด้านบน num คือจำนวนคอลัมน์ที่เซลล์ส่วนหัวควรขยาย
ให้เราดูตัวอย่างการใช้แอตทริบิวต์ colspan ขององค์ประกอบ
ตัวอย่าง
<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
border: 2px solid green;
}
</style>
</head>
<body>
<h2>Product Expenses</h2>
<table>
<tr>
<th colspan="2">Expenses</th>
</tr>
<tr>
<td>Product Development</td>
<td>500000</td>
</tr>
<tr>
<td>Marketing</td>
<td>500000</td>
</tr>
<tr>
<td>Services</td>
<td>100000</td>
</tr>
<tr>
<td>Support</td>
<td>100000</td>
</tr>
<tr>
<td>Maintenance</td>
<td>100000</td>
</tr>
<tr>
<td colspan="2">Total Budget = INR 1300000</td>
</tr>
</table>
</body>
</html> ผลลัพธ์
