Problem Statement
Which tag is used to define a row in an HTML table?
Explanation
The tr tag is used to define a row in an HTML table. The tr stands for table row. Each row in a table is wrapped in a tr tag. Inside each tr tag, you place td tags for data cells or th tags for header cells. All cells in a row appear horizontally aligned. The number of cells in each row should generally be consistent across the table, unless you use colspan or rowspan attributes. Tables are built row by row, from top to bottom. Each tr tag represents one horizontal line of data in your table. Understanding how rows are structured is fundamental to working with HTML tables.
Code Solution
SolutionRead Only
<!-- Table with three rows -->
<table>
<tr>
<td>Row 1, Cell 1</td>
<td>Row 1, Cell 2</td>
</tr>
<tr>
<td>Row 2, Cell 1</td>
<td>Row 2, Cell 2</td>
</tr>
<tr>
<td>Row 3, Cell 1</td>
<td>Row 3, Cell 2</td>
</tr>
</table>