Skip to content
Related Articles

Related Articles

Improve Article
HTML tr Tag
  • Last Updated : 17 Sep, 2019

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:

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

Example:




<!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>

Output:

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

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Apple Safari
  • Opera



My Personal Notes arrow_drop_up
Recommended Articles
Page :