मैं एक टेबल हेडर एक तरफ दो टेबल कॉलम पर केंद्रित होना चाहता हूं। क्या यह संभव है?क्या मेरे पास एक HTML तालिका शीर्षलेख दो तालिका कॉलम से अधिक हो सकता है? एक्सेल में विलय और केंद्र की तरह?
19
A
उत्तर
40
<th colspan="2">. This .</th>
थोड़ा अनुमान लगाना ...
<table>
<thead>
<tr>
<th>Single Column</th>
<th colspan="2">Double Column</th>
</tr>
</thead>
<tbody>
<tr>
<td>Column One</td>
<td>Column Two</td>
<td>Column Three</td>
</tr>
</tbody>
</table>
कि यदि आपके पास पर्याप्त से काम करने के लिए देना चाहिए।
4
बेशक। कृपया this पृष्ठ देखें। आप तालिका शीर्षलेख कक्षों के लिए colspan
नामक विशेषता की तलाश में हैं।
6
यदि आपके पास केवल 2 कॉलम हैं तो मैं <caption>
का उपयोग करने का सुझाव दूंगा। अन्यथा, अन्य उत्तरों में सुझाए गए अनुसार colspan का उपयोग करें।
<table>
<caption>This will span all columns.</caption>
<tr><td>column one</td><td>column two</td></tr>
</table>
0
हम इसे बेहतर तरीके से कर सकते हैं।
<table border="1">
<tr>
<th colspan="1" scope="colgroup">Test Heading</th>
<th colspan="3" scope="colgroup">Mars</th>
<th colspan="3" scope="colgroup">Venus</th>
<th colspan="3" scope="colgroup">Test</th>
</tr>
<tr>
<th rowspan="2"></th>
<th scope="col">Produced</th>
<th scope="col">Sold</th>
<th scope="col">Sold</th>
<th scope="col">Produced</th>
<th scope="col">Sold</th>
<th scope="col">Sold</th>
<th scope="col">Test 1</th>
<th scope="col">Test 2</th>
<th scope="col">Test 3</th>
</tr>
</table>
कृपया देखें Table Ref From w3.org यदि आप और अधिक जानना चाहते हैं।