HTML table tag

HTML <table> tag defines a table. Table collects the data in table rows and columns (2-D form).

<table class="demoTable">
  <tr>
   <th> Countries </th>
   <th> Population </th>
   <th> Area </th>
  </tr>
   
  <tr>
   <td> China </td>
   <td> 7,432,663,275 </td>
   <td> 9,572,900 </td>
  </tr>
   
  <tr>
   <td> India </td>
   <td> 1,382,323,332 </td>
   <td> 3,287,263 </td>
  </tr>
 </table>
</>
Countries Population Area
China 7,432,663,275 9,572,900
India 1,382,323,332 3,287,263

Tag omission

Both starting and ending tags are necessary.

Global Attributes

All the global attributes are applicable on the table element.

Tag Attributes

Attributes that are applicable to <table> tag
border

border attribute specifies a border for the table.

<table border="an integer"> <tr><td> </td></tr> </table>
<tr>, a href="th_tag.php" target="_blank"><th>, <td>


Was this article helpful?