HTML td tag

HTML <td> tag represents a cell of data in a table. The data is placed in these cells.

<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>Indonesia</td>
   <td>260,581,100</td>
   <td>1,904,556</td>
  </tr>

</table>
</>
Countries Population Area
China 7,432,663,275 9,572,900
Indonesia 260,581,100 1,904,556

In the above example, the table has three rows. And each row has three data cells.

Here the caption element defines the title or context of the table.

Tag omission

End tag (<td>) element may be omitted.

Global Attributes

All global attributes are applicable on the td element.

Tag Attributes

Attributes that are applicable to <td> tag
rowspan

spans more than one rows for table data cell.

<table> <tr><td rowspan="no of rows to span"> a cell of data </td></tr> </table>
colspan

spans more than one columns for table data cell.

<table> <tr><td colspan="no of columns to span"> a cell of data </td></tr> </table>


Was this article helpful?