एचटीएमएल <वें> टैग
उदाहरण
तीन पंक्तियों, दो हेडर सेल और चार डेटा सेल वाली एक साधारण HTML तालिका:
<table>
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
<tr>
<td>February</td>
<td>$80</td>
</tr>
</table>
नीचे और अधिक "इसे स्वयं आज़माएं" उदाहरण।
परिभाषा और उपयोग
<th>
टैग HTML तालिका में हेडर सेल को परिभाषित करता है ।
एक HTML तालिका में दो प्रकार की कोशिकाएँ होती हैं:
- हैडर सेल - इसमें हेडर की जानकारी होती है (
<th>
तत्व के साथ बनाई गई) - डेटा सेल - इसमें डेटा होता है ( <td> तत्व के साथ बनाया गया)
<th>
तत्वों में पाठ डिफ़ॉल्ट रूप से बोल्ड और केंद्रित होता है।
<td> तत्वों में पाठ डिफ़ॉल्ट रूप से नियमित और बाएँ-संरेखित होते हैं।
ब्राउज़र समर्थन
Element | |||||
---|---|---|---|---|---|
<th> | Yes | Yes | Yes | Yes | Yes |
गुण
Attribute | Value | Description |
---|---|---|
abbr | text | Specifies an abbreviated version of the content in a header cell |
colspan | number | Specifies the number of columns a header cell should span |
headers | header_id | Specifies one or more header cells a cell is related to |
rowspan | number | Specifies the number of rows a header cell should span |
scope | col colgroup row rowgroup |
Specifies whether a header cell is a header for a column, row, or group of columns or rows |
वैश्विक गुण
<th>
टैग HTML में वैश्विक विशेषताओं का भी समर्थन करता है ।
घटना गुण
<th>
टैग HTML में ईवेंट विशेषताओं का भी समर्थन करता है ।
और ज्यादा उदाहरण
उदाहरण
<वें> (सीएसएस के साथ) के अंदर सामग्री को कैसे संरेखित करें:
<table style="width:100%">
<tr>
<th style="text-align:left">Month</th>
<th
style="text-align:left">Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
<tr>
<td>February</td>
<td>$80</td>
</tr>
</table>
उदाहरण
टेबल हेडर सेल (सीएसएस के साथ) में बैकग्राउंड-कलर कैसे जोड़ें:
<table>
<tr>
<th
style="background-color:#FF0000">Month</th>
<th style="background-color:#00FF00">Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
</table>
उदाहरण
टेबल हेडर सेल की ऊंचाई कैसे सेट करें (सीएसएस के साथ):
<table>
<tr>
<th
style="height:100px">Month</th>
<th style="height:100px">Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
</table>
उदाहरण
टेबल हेडर सेल (सीएसएस के साथ) में नो वर्ड-रैपिंग कैसे निर्दिष्ट करें:
<table>
<tr>
<th>Month</th>
<th style="white-space:nowrap">My Savings for a new car</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
</table>
उदाहरण
<वें> (सीएसएस के साथ) के अंदर सामग्री को लंबवत कैसे संरेखित करें:
<table style="width:50%;">
<tr
style="height:100px">
<th style="vertical-align:bottom">Month</th>
<th
style="vertical-align:bottom">Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
</table>
उदाहरण
टेबल हेडर सेल की चौड़ाई कैसे सेट करें (सीएसएस के साथ):
<table style="width:100%">
<tr>
<th style="width:70%">Month</th>
<th
style="width:30%">Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
</table>
उदाहरण
टेबल हेडर कैसे बनाएं:
<table>
<tr>
<th>Name</th>
<th>Email</th>
<th>Phone</th>
</tr>
<tr>
<td>John Doe</td>
<td>[email protected]</td>
<td>123-45-678</td>
</tr>
</table>
उदाहरण
कैप्शन के साथ टेबल कैसे बनाएं:
<table>
<caption>Monthly savings</caption>
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
<tr>
<td>February</td>
<td>$80</td>
</tr>
</table>
उदाहरण
एक से अधिक पंक्तियों या एक कॉलम में फैले टेबल सेल को कैसे परिभाषित करें:
<table>
<tr>
<th>Name</th>
<th>Email</th>
<th colspan="2">Phone</th>
</tr>
<tr>
<td>John Doe</td>
<td>[email protected]</td>
<td>123-45-678</td>
<td>212-00-546</td>
</tr>
</table>
संबंधित पृष्ठ
एचटीएमएल ट्यूटोरियल: एचटीएमएल टेबल्स
एचटीएमएल डोम संदर्भ: टेबलहेडर ऑब्जेक्ट
सीएसएस ट्यूटोरियल: स्टाइलिंग टेबल्स
डिफ़ॉल्ट सीएसएस सेटिंग्स
अधिकांश ब्राउज़र <th>
निम्न डिफ़ॉल्ट मानों के साथ तत्व प्रदर्शित करेंगे:
th {
display: table-cell;
vertical-align: inherit;
font-weight: bold;
text-align: center;
}