Tebura a cikin HTML: Jagora don Ƙirƙirar da Tsara Tables a cikin HTML

Teburi wani abu ne mai mahimmanci a cikin HTML don nuna bayanai a cikin tsari mai tsari tare da layuka da ginshiƙai. A cikin HTML, ana ƙirƙira tebur ta amfani da tags <tebur>, <tr>, da <td>.

Alamar <tebur> tana wakiltar babban kwandon tebur, wanda ya ƙunshi dukkan layuka da ginshiƙai. Ana bayyana layuka ta amfani da alamar <tr>(jere na tebur), yayin da ake siffanta sel a cikin layuka ta amfani da alamar <td>(bayanin tebur). Bugu da ƙari, za ka iya amfani da alamar <th>(tebur) don ayyana sel masu kai ga tebur.

Kuna iya amfani da sifofi kamar colspan da rowspan don haɗa sel a cikin tebur ko taƙasa sel a cikin layuka da ginshiƙai. Bugu da ƙari, kuna iya amfani da kaddarorin CSS don keɓance bayyanar da shimfidar tebur.

 

Tebur( <table>)

- <table> Ana amfani da sinadarin don ƙirƙirar tebur a cikin HTML.

- Ana sanya bayanai a cikin layuka( <tr>) da ginshiƙai( <td> ko <th>).

- Kowane tantanin halitta ana sanya shi a cikin abubuwan <td>(wayoyin salula) ko <th>(wayoyin kai).

<table>  
  <tr>  
    <th>No.</th>  
    <th>Name</th>  
    <th>Age</th>  
  </tr>  
  <tr>  
    <td>1</td>  
    <td>John</td>  
    <td>25</td>  
  </tr>  
  <tr>  
    <td>2</td>  
    <td>Jane</td>  
    <td>30</td>  
  </tr>  
</table>  

 

Babban shafi( <th>)

- <th> Ana amfani da kashi don ƙirƙirar rubutun shafi a cikin tebur.

- Yawanci an sanya shi a jere na farko na tebur.

<table>  
  <tr>  
    <th>No.</th>  
    <th>Name</th>  
    <th>Age</th>  
  </tr>  
  <!-- data rows -->  
</table>  

 

Layukan Bayanai( <tr>):

- <tr> Ana amfani da sinadarin don ƙirƙirar layuka na bayanai a cikin tebur.

- Kwayoyin bayanai( <td>) ko sel masu kai( <th>) Ana sanya su cikin waɗannan <tr> abubuwan.

<table>  
  <tr>  
    <th>No.</th>  
    <th>Name</th>  
    <th>Age</th>  
  </tr>  
  <tr>  
    <td>1</td>  
    <td>John</td>  
    <td>25</td>  
  </tr>  
  <tr>  
    <td>2</td>  
    <td>Jane</td>  
    <td>30</td>  
  </tr>  
</table>  

 

Ƙwaƙwalwar ginshiƙi( colspan)

Ana amfani da sifa colspan don tantance adadin ginshiƙan da tantanin halitta na bayanai ko tantanin kai zai ɗaga cikin tebur.

<table>  
  <tr>  
    <th colspan="2">Personal Information</th>  
  </tr>  
  <tr>  
    <td colspan="2">John Doe</td>  
  </tr>  
</table>  

 

Layin Layi( rowspan)

Ana amfani da sifa rowspan don ƙididdige adadin layuka waɗanda tantanin halitta ko tantanin kai zai ɗaga cikin tebur.

<table>  
  <tr>  
    <th rowspan="2">No.</th>  
    <td>1</td>  
    <td>John</td>  
  </tr>  
  <tr>  
    <td>2</td>  
    <td>Jane</td>  
  </tr>  
</table>  

 

Haɗuwar Kwayoyin( colspan da rowspan)

Kuna iya haɗa duka biyu colspan da rowspan sifofi don haɗa sel a cikin tebur.

<table>  
  <tr>  
    <th rowspan="2">No.</th>  
    <th colspan="2">Personal Information</th>  
  </tr>  
  <tr>  
    <td>John</td>  
    <td>25</td>  
  </tr>  
</table>  

 

border dukiya

- border Kayan yana ƙayyade kauri na iyakar tebur.

- darajar border ita ce lambar da ba ta da kyau.

<table border="1">  
<!-- Table rows and columns -->  
</table>  

 

cellpadding dukiya

-, cellpadding Kayan yana ƙayyade nisa tsakanin abun cikin tantanin halitta da iyakar tantanin halitta a cikin tebur.

- darajar ita cellpadding ce lambar da ba ta da kyau

<table cellpadding="5">  
<!-- Table rows and columns -->  
</table>  

 

cellspacing dukiya

- cellspacing Kayan yana ƙayyade tazara tsakanin sel a cikin tebur.

- darajar cellspacing ita ce lambar da ba ta da kyau.

<table cellspacing="10">  
<!-- Table rows and columns -->  
</table>  

 

Waɗannan halaye da abubuwan suna ba ku damar ƙirƙira da tsara tebur a cikin HTML gwargwadon bukatunku. Kuna iya amfani da su don nuna bayanai a sarari da tsari akan gidan yanar gizon ku.