Open In App

HTML tr Tag

The <tr> tag is used to define a row in an HTML table. The <tr> element contains multiple <th> or <td> elements. 

Syntax

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

Attributes

Example: This example describe the basic usage of the <tr> tag in HTML Table.






<!DOCTYPE html>
<html>
 
<head>
    <title>tr tag</title>
    <style>
        body {
            text-align: center;
        }
 
        h1 {
            color: green;
        }
 
        th {
            color: blue;
        }
 
        table,
        tbody,
        td {
            border: 1px solid black;
            border-collapse: collapse;
        }
    </style>
</head>
 
<body>
    <center>
        <h1>GeeksforGeeks</h1>
        <h2>tr Tag</h2>
        <table>
            <thead>
                <!-- tr tag starts here -->
                <tr>
                    <th>Name</th>
                    <th>User Id</th>
                </tr>
                <!-- tr tag end here -->
            </thead>
            <tbody>
                <tr>
                    <td>Shashank</td>
                    <td>@shashankla</td>
                </tr>
                <tr>
                    <td>GeeksforGeeks</td>
                    <td>@geeks</td>
                </tr>
            </tbody>
        </table>
    </center>
</body>
 
</html>

Explanation

Output: 



 

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

Supported Browsers

The browsers supported by HTML <tr> Tag are listed below:


Article Tags :