แอตทริบิวต์ HTML rowspan กำหนดจำนวนแถวที่เซลล์ของตารางควรขยายในเอกสาร HTML สามารถใช้ได้กับ td . เท่านั้น หรือ ที่ องค์ประกอบ HTML
ไวยากรณ์
ต่อไปนี้เป็นไวยากรณ์ -
<tagname rowspan=”number”></tagname>
ให้เรามาดูตัวอย่าง HTML rowspan Attribute −
ตัวอย่าง
<!DOCTYPE html>
<html>
<style>
body {
color: #000;
background: lightblue;
height: 100vh;
text-align: center;
}
table {
margin: 2rem auto;
width: 400px;
}
</style>
<body>
<h1>HTML rowspan Attribute Demo</h1>
<table border="2">
<thead>
<tr>
<th>Name</th>
<th>Language</th>
</tr>
<thead>
<tbody>
<tr>
<td>John</td>
<td>English</td>
</tr>
<tr>
<td rowspan="2">Elon</td>
<td>Germany</td>
</tr>
<tr>
<td>French</td>
</tr>
</tbody>
</table>
</body>
</html> ผลลัพธ์
