Attributes of Tr Tag
Halign
Halign sets the horizontal alignment of cells in the row. It takes up the values left, center and right.
| Example |
| <tr halign=left> <td>common jokes</td> </tr> |
| |
Valign
Valign sets the vertical alignment of the row. It can be set to top, middle, bottom or baseline.
| Example |
| <tr valign=top> <td>common jokes </td> </tr> |
| |
Bordercolor
Bordercolor works similarly as with the <table> tag. The basic difference is it only sets the colors of the inside borders.
| Example |
| <tr bordercolor=red> <td> common jokes </td> </tr> |
| |
Td Tag
The <td> tag is the table data tag. The <td> tag sets a single table cell in which data is shown. It works with XHTML as it does in HTML.
The “bgcolor”, “height”, “width”, and “nowrap” attributes of the <td> tag of HTML are not supported in XHTML.
| Example |
<tr> |
<td> weird jokes </td> |
<td> classic jokes </td> |
</tr> |
| |
Attributes of <td> Tag
Align
Align is the horizontal alignment of text within the table cell. It takes up the values left, center, and right.
| Example |
| <td align=left> classic jokes </td> |
| |
Valign
Valign sets the vertical alignment of text within the table cell. It takes up the values top, middle, center, bottom, and baseline.
Example |
<td valign=top> classic jokes </td> |
| |
Colspan and Rowspan
Table cells can span across more than one column or row. The attributes colspan and rowspan indicate how many columns or rows a cell should take up. We can create a cell which is equivalent to two cells.
Example |
<tr border=2> |
<td colspan=2> jokes </td> |
<td> classic jokes </td> <td> cricket jokes</td> |
</tr> |
| |
Bordercolor
Bordercolor works similarly as it works with the <table> tag. It sets the color of the entire border around a cell.
Example |
<tr border=2> <td bordercolor=red> Nature Jokes </td> </tr> |
| |
Th Tag
The <th> tag works just like the <td> tag, except that, the cell is a header for column or row. The header is like a title for column or row. Its attributes are also same as the <td> tag.
The “bgcolor”, “height”, “width”, and “nowrap” attributes of the <th> tag in HTML are not supported in XHTML.
Example |
<tr> <th> Category of jokes </th> </tr> |
| |
|