HTML Tutorial
<tr>
The <tr>
tag defines a row in an HTML table. It is always used within a <table>
element. Each row of a table can contain one or more
<tr>
The <tr>
tag supports the following attributes:
<tr>
<table>
<tr>
<th>Name</th>
<th>Age</th>
</tr>
<tr>
<td>John</td>
<td>30</td>
</tr>
<tr>
<td>Mary</td>
<td>25</td>
</tr>
</table>
Exploring the <tr>
Tag
The following HTML example demonstrates the use of the <tr>
tag:
<!DOCTYPE html>
<html>
<body>
<table>
<tr> <!-- Row 1 -->
<th>Name</th> <!-- Header cell -->
<th>Age</th> <!-- Header cell -->
</tr>
<tr> <!-- Row 2 -->
<td>John</td> <!-- Data cell -->
<td>30</td> <!-- Data cell -->
</tr>
<tr> <!-- Row 3 -->
<td>Mary</td> <!-- Data cell -->
<td>25</td> <!-- Data cell -->
</tr>
</table>
</body>
</html>
This code will create a simple HTML table with two columns and three rows. The first row contains the table headers, and the second and third rows contain the data.