table in html


Table Tag in HTML


Html मे सारणी बनाने के लिये Table Tag का उपयोग किया जाता है।
किसी Table का तत्व का सामान्य रूप निम्न प्रकार है-
<table>
    Table Data
</table>
इससे स्पष्ट है कि सारणी बनाने का प्रारंभ <Table> Tag से किया जाता है और समापन </table> Tag से किया जाता है। इन दोनो के बीच मे Table के Data को परिभाषित किया जाता है। इस Data मे Table का नाम प्रत्येक पंक्ति के प्रत्येक सैल की परिभाषा आदि शामिल होती है। इनको परिभाषित करने के लिये विभिन्न Tag का उपयोग किया जाता है।
<table> :- इसके द्वारा हम table को define करते है !


<th> :- इसका use करके हम table में heading define करते है ,इसका पूरा नाम table head है ! 

<tr> :- इससे हम table में row define करते है,इसका पुरा नाम table row है !

<td> :- इससे हम table में data को लिखते है,ये table में सेल को define करता है,इसका पूरा नाम table data है !

1.Tr tag (Table row tag):-
सारणी के किसी रौ को परिभाषित करने के लिये <tr>(table row) Tag का उपयोग किया जाता है। एक टेबल में हम कितनी भी लाइन बना सकते है !
उदाहरण के लिये यदि हम केवल एक ही रौ वाली Table बनाते है, तो उसे इस प्रकार बना सकते है 


<html>
  <head>
      <title>table in HTML</title>
  </head>
  <body>
    <table border=1>
         <tr>first row</tr>
         <tr>second row</tr>
         <tr>third row</tr>
    </table>
  </body>
</html>


Output of this



2.Th tag (Table heading tag):-

table में heading बनाने के लिए हम इस <th> tag का use किया जाता है,इसका पूरा नाम table heading है,
table में हम पप्रत्येक column को अलग-अलग नाम देते है, जिससे की हम उस column के data को हम आसानी से पहचान पाए th tag  by default bold और align center होती  है !

Not :- "table heading को हम अधिकतर table की पहली row में define करते है !"


  <html>
     <head>
         <title>table in HTML</title>
     </head>
   <body> 
   <table border=1>
    <tr>
          <th>first column</th>   
          <th>second column</th>
         <th>thoifd column</th>
    </tr>
 </table>
     </body>
  </html>



Output of this



3. Td tag (Table data tag):-

सारणी के किसी सैल को परिभाषित करने के लिये <td>(table data) Tag का उपयोग किया जाता है।<td> टैग का use कितनी भी बार किया जा सकता है।
Not:-" हम एक td (table row) में कितनी भी td (table data) बना सकते है !"

उदाहरण के लिये यदि हम केवल एक सैल वाली सारणी बनाना चाहते है, तो उसे निम्न प्रकार बना सकते है-

  <html>
  <head>
      <title>table in HTML</title>
  </head>
  <body>
    <table border=1>
    <tr>
          <th>first column</th>   
          <th>second column</th>
         <th>thoifd column</th>

   <tr>   
         <td>1st row 1st column</td>
         <td>1st row 2nd column</td>
         <td>1st row 3rd column</td>
   </tr>
   <tr>   
          <td>2nd row 1st column</td>
         <td>2nd row 2nd column</td>
         <td>2nd row 3rd column</td>
   </tr>
   <tr>   
         <td>3rd row 1st column</td>
         <td>3rd row 2nd column</td>
         <td>3rd row 3rd column</td>
   </tr>
</table>
  </body>
</html>


Output of this


Comments