Use Of TR Tag
<TR> tag is used to create rows in HTML Tables. <TR> is the opening tag to start a row and </TR> is a closing tag to end a row. You can place pairs of <td>…</td> tags to create data cells in a row within the <tr>…</tr> tags.
for example to create a row with only one cell containing data “Apples”, we will use the following html code.and Mangoes respectively:
If you want to create a row with two cells containing data “Apples” and “Mangoes” respectively, we will use the following html code.
You canm also create a header row with the help of <TR> tag and <TH> tags. For example, to create a header row with two header cells with contents “Employee” and “Salary”, we will use the following HTML coding:
Attributes of TR Tag
It is used to define the horizontal alignment of text in cells, in a particular row. The possible values are:
left: The text is aligned to the left.
center: The text is centered.
right: The text is aligned to the right.
justify: The text is justified to both, left and right, margins.
Example HTML code
It defines vertical alignment of the text with in cells in a row. Possible values are:
top: The text is aligned to the top.
middle: The text is vertically centered. This is the default value.
bottom: The text is aligned to the botom.
It defines the background color that will be used as background of all the cells inside the row.
For example, if we use <tr bgcolor=”green”>, all cells in this row will have a green background as shown below.