HTML table row - how to use <tr> tag

The HTML <tr> tag is used to define a table row. Cells within the table row can be set using the <th> and <td> tags.

Attributes

The tr tag supports the global and event attributes.

Examples:

<table border="1"> <thead> <tr> <th>Country</th> <th>Capital</th> <th>City</th> </tr> </thead> <tbody> <tr> <td>China</td> <td>Beijing</td> <td>Shanghai</td> </tr> <tr> <td>India</td> <td>New Delhi</td> <td>Hyderabad</td> </tr> </tbody> <tfoot> <tr> <td>Table</td> <td>Ends</td> <td>Here</td></tr> </tfoot> </table>

Related HTML tags and Useful Links:

  • <table> - used to define a table
  • <thead> - used to define header of the table
  • <tbody> - used to define the table body
  • <tfoot> - used to define footer of the table
  • <th> - used to define header cells
  • <tr> - used to define table row
  • <td> - used to define the cell of the table
  • <caption> - used to define caption / title of the table
  • <col> - used to define properties of columns defined within the <colgroup> tag
  • <colgroup> - used to group one or more columns
  • Learn more about HTML table