HTML <tr> Tag: Table Row
The <tr> tag in HTML defines a row in a table. Inside <tr>, you place table cells using <td> (table data) for regular cells and <th> (table header) for header cells.
1. Basic Syntax
✅ Displays:
| Header 1 | Header 2 |
|---|---|
| Data 1 | Data 2 |
2. Using <tr> with Multiple Rows
✅ Adds multiple rows to the table.
3. Merging Cells with colspan and rowspan
You can span multiple columns or rows using colspan and rowspan.
Column Span (colspan)
✅ Merges two columns into one.
Row Span (rowspan)
✅ Merges two rows into one.
4. Styling <tr> with CSS
✅ Alternates row colors and adds a hover effect.
5. Conclusion
-
<tr>defines rows in a table. -
Use
<td>for data cells and<th>for header cells. -
Use
colspanandrowspanto merge cells. -
CSS can style rows for better readability.

