Open In App

HTML tr Tag

Last Updated : 12 Jul, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

The <tr> tag in HTML is used to define a row in a table. It is a container for table cells, which can be either <td> (data cell) or <th> (header cell). The <tr> tag is placed inside a <table> element and groups cells horizontally.

Note: The <tr> tag also supports the Global Attributes and the Event Attributes in HTML.

html
<!DOCTYPE html>
<html>

<head>
    <style>
        table, th, td {
            border: 1px solid black;
            border-collapse: collapse;
        }
    </style>
</head>

<body>
    <table>
        <tr>
            <th>Name</th>
            <th>User Id</th>
        </tr>
        <tr>
            <td>Shashank</td>
            <td>@shashankla</td>
        </tr>
        <tr>
            <td>GeeksforGeeks</td>
            <td>@geeks</td>
        </tr>
    </table>
</body>

</html>

Syntax

<tr>.....</tr>

Attributes

  • align: Align the content.
  • bgcolor: Specify the background of the row
  • char: Align the content to a character
  • charoff: Set the number of character
  • valign: Vertical align the content

Similar Reads