HTML - <tr> Tag


Advertisements


Description

The HTML <tr> tag is used for specifying a table row within a table.

Example

<!DOCTYPE html>
<html>

   <head>
      <title>HTML tr Tag</title>
   </head>

   <body>
      <table border = "1">
         <tr>
            <th>Cricketers</th>
            <th>Ranking</th>
         </tr>
         
         <tr>
            <td>M.S Dhoni</td>
            <td>1</td>
         </tr>
         
         <tr>
            <td>Yuvraj Singh</td>
            <td>2</td>
         </tr>
         
         <tr>
            <td>Virat Kohli</td>
            <td>3</td>
         </tr>
      </table>
   </body>

</html>

This will produce the following result −

Global Attributes

This tag supports all the global attributes described in − HTML Attribute Reference

Specific Attributes

The HTML <tr> tag also supports the following additional attributes −

Attribute Value Description
align right
left
center
justify
char
Deprecated − Visual alignment.
bgcolor rgb(x,x,x)
#hexcode
colorname
Deprecated − Specifies the background color of the table cell.
char character Deprecated − Specifies which character to align text on. Used when align = "char".
charoff pixels or % Deprecated − Specifies an alignment offset (either in pixels or percentage value) against the first character as specified with the char attribute. Used when align = "char".
valign top
middle
bottom
baseline
Deprecated − Vertical alignment.

Event Attributes

This tag supports all the event attributes described in − HTML Events Reference

Browser Support

Chrome Firefox IE Opera Safari Android
Yes Yes Yes Yes Yes Yes

html_tags_reference.htm

Advertisements