HTML में colspan विशेषता का उपयोग किसी तालिका में एक सेल द्वारा फैले कॉलम की संख्या निर्धारित करने के लिए किया जाता है। या तत्व पर colspan विशेषता का उपयोग करें।
तत्व colspan विशेषता
HTML में एलिमेंट का colspan एट्रिब्यूट यह निर्धारित करता है कि सेल में कितने कॉलम होने चाहिए
निम्नलिखित वाक्य रचना है -
<td colspan="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 विशेषता
एलिमेंट के कोलस्पैन एट्रिब्यूट का इस्तेमाल हेडर सेल में कॉलम की संख्या सेट करने के लिए किया जाता है।
निम्नलिखित वाक्य रचना है -
<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>
आउटपुट