एचटीएमएल <td> टैग
उदाहरण
दो पंक्तियों और चार तालिका कक्षों के साथ एक साधारण HTML तालिका:
<table>
<tr>
<td>Cell A</td>
<td>Cell B</td>
</tr>
<tr>
<td>Cell C</td>
<td>Cell D</td>
</tr>
</table>
नीचे और अधिक "इसे स्वयं आज़माएं" उदाहरण।
परिभाषा और उपयोग
<td>
टैग HTML तालिका में एक मानक डेटा सेल को परिभाषित करता है ।
एक HTML तालिका में दो प्रकार की कोशिकाएँ होती हैं:
- हैडर सेल - इसमें हेडर जानकारी होती है ( <वें> तत्व के साथ बनाई गई)
- डेटा सेल - इसमें डेटा होता है (
<td>
तत्व के साथ बनाया गया)
<td>
तत्वों में पाठ डिफ़ॉल्ट रूप से नियमित और बाएँ-संरेखित होते हैं।
<th> तत्वों में टेक्स्ट डिफ़ॉल्ट रूप से बोल्ड और केंद्रित होता है।
ब्राउज़र समर्थन
Element | |||||
---|---|---|---|---|---|
<td> | Yes | Yes | Yes | Yes | Yes |
गुण
Attribute | Value | Description |
---|---|---|
colspan | number | Specifies the number of columns a cell should span |
headers | header_id | Specifies one or more header cells a cell is related to |
rowspan | number | Sets the number of rows a cell should span |
वैश्विक गुण
<td>
टैग HTML में वैश्विक विशेषताओं का भी समर्थन करता है ।
घटना गुण
<td>
टैग HTML में ईवेंट विशेषताओं का भी समर्थन करता है ।
और ज्यादा उदाहरण
उदाहरण
<td> (सीएसएस के साथ) के अंदर सामग्री को कैसे संरेखित करें:
<table style="width:100%">
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td
style="text-align:right">$100</td>
</tr>
<tr>
<td>February</td>
<td
style="text-align:right">$80</td>
</tr>
</table>
उदाहरण
टेबल सेल में बैकग्राउंड-कलर कैसे जोड़ें (सीएसएस के साथ):
<table>
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td
style="background-color:#FF0000">January</td>
<td
style="background-color:#00FF00">$100</td>
</tr>
</table>
उदाहरण
टेबल सेल की ऊंचाई कैसे सेट करें (सीएसएस के साथ):
<table>
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td
style="height:100px">January</td>
<td
style="height:100px">$100</td>
</tr>
</table>
उदाहरण
टेबल सेल (सीएसएस के साथ) में नो वर्ड-रैपिंग कैसे निर्दिष्ट करें:
<table>
<tr>
<th>Poem</th>
</tr>
<tr>
<td
style="white-space:nowrap">Never increase, beyond what is necessary, the
number of entities required to explain anything</td>
</tr>
</table>
उदाहरण
<td> (सीएसएस के साथ) के अंदर सामग्री को लंबवत कैसे संरेखित करें:
<table style="width:50%;">
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr style="height:100px">
<td
style="vertical-align:bottom">January</td>
<td
style="vertical-align:bottom">$100</td>
</tr>
</table>
उदाहरण
टेबल सेल की चौड़ाई कैसे सेट करें (सीएसएस के साथ):
<table style="width:100%">
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td style="width:70%">January</td>
<td style="width:30%">$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>
संबंधित पृष्ठ
एचटीएमएल ट्यूटोरियल: एचटीएमएल टेबल्स
एचटीएमएल डोम संदर्भ: टेबलडेटा ऑब्जेक्ट
सीएसएस ट्यूटोरियल: स्टाइलिंग टेबल्स
डिफ़ॉल्ट सीएसएस सेटिंग्स
अधिकांश ब्राउज़र <td>
निम्न डिफ़ॉल्ट मानों के साथ तत्व प्रदर्शित करेंगे:
td {
display: table-cell;
vertical-align: inherit;
}