HTML <tr> Tag
In this tutorial, we will learn about tr tag in HTML with the help of examples.
<tr> Tag
Tr tag <tr> is used to define a row in an HTML table.
Note : The <tr> tag can contain one or more <th> or <td> tag.
Syntax
<tr>..........</tr>
Example
<!DOCTYPE html>
<html>
<head>
<title>tr tag</title>
</head>
<body>
<table>
<thead>
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>Age</th>
</tr>
</thead>
<tbody>
<tr>
<td>Sunny</td>
<td>Chaudhary</td>
<td>20</td>
</tr>
<tr>
<td>Anu</td>
<td>Chaudhary</td>
<td>19</td>
</tr>
</tbody>
</table>
</body>
</html>
Output
Specific Attribute
Attribute | Value | Description |
---|---|---|
align | right left center justify char |
It is used for visual alignment |
bgcolor | rgb(x,x,x) #hexcode colorname |
It is used to specify the background color of the table cell |
char | character | It is used to specify which character to align text on. It is used when align = char |
charoff | pixels percentage(%) |
It is used to specify an alignment offset(either in pixels or percentage value) against the first character as specified with the char attribute. It is used when align = char |
valign | top middle bottom baseline |
It is used for vertical alignment |
Global Attribute
Tr Tag support all the global attributes of HTML.
Event Attribute
Tr Tag support all the event attributes of HTML.
Next Tutorial
We hope that this tutorial helped you develop better understanding of the concept of <tr> tag in HTML.
Keep Learning : )
In the next tutorial, you'll learn about HTML <track>
Tag.