html
  1. html-tr-tag

HTML <tr> Tag

  • The HTML <tr> tag defines a row in an HTML table.
  • It is used to group HTML table data (HTML <td> tags) together.
  • The content of the <tr> tag is represented by a row in an HTML table.

Syntax

The basic syntax for the <tr> tag is:

<table>
  <tr>
    <td>Row 1, Column 1</td>
    <td>Row 1, Column 2</td>
  </tr>
  <tr>
    <td>Row 2, Column 1</td>
    <td>Row 2, Column 2</td>
  </tr>
</table>

Example

<table>
  <tr>
    <td>1</td>
    <td>John</td>
    <td>Doe</td>
  </tr>
  <tr>
    <td>2</td>
    <td>Jane</td>
    <td>Doe</td>
  </tr>
</table>
Try Playground

Explanation

The <tr> tag stands for "table row". It is used to group HTML table data within a table. It is always used inside the <table> tag. The content of the <tr> tag is represented by a row in an HTML table.

Each row contains one or more <td> elements, which represent the cells of the table. The cells contain the actual data that is displayed in the table.

Use

The <tr> tag is used to group HTML table data. It is typically used to structure large amounts of tabular data, such as financial data, sales data, or any other type of data that can be represented in a tabular format.

Important Points

  • The <tr> tag should always be used within a <table> element.
  • Each row () should contain one or more table data cells ().
  • The number of columns in a table is determined by the number of cells in the first row () of the table.
  • The <tr> tag can also be used to define header cells (HTML <th> tags) for a table.

Summary

The <tr> tag is an important part of HTML table structure. It is used to group HTML table data together and represents a row in an HTML table. The web developer can use tr tag to define the structure of the table and its rows. The table data cells (<td>) in each row can contain text, images, buttons, or any other type of HTML content.

Published on: