<tr align="" valign=""><td align="" valign="">

Browser
  • IE
  • Cr
  • Sf
  • Fx
  • O

The align and valign attributes of the TR and TD (TH) elements specifies the alignment of cell content.


<tr align="center" valign="top"></tr> : Applied to all cells in a row

<td align="center" valign="top"></td> : Applied to one cell

Attribute Value Explanation
align=" " horizontal alignment in cell
left aligns to the left
center aligns to the center
right aligns to the right
valign=" " vertical alignment in cell
top aligns to the top
middle aligns to the middle
bottom aligns to the bottom

Example

Horizontal alignment

<table border="1" width="100%" height="100">
<tr>
<td width="25%">Default</td>
<td align="left" width="25%">Left</td>
<td align="center" width="25%">Center</td>
<td align="right" width="25%">Right</td>
</tr>
</table>

Output
Default Left Center Right
Vertical alignment

<table border="1" width="100%" height="100">
<tr>
<td width="25%">Default</td>
<td valign="top" width="25%">Top</td>
<td valign="middle" width="25%">Middle</td>
<td valign="bottom" width="25%">Bottom</td>
</tr>
</table>

Output
Default Top Middle Bottom
Horizontal and Vertical alignment

<table border="1" width="100%" height="100">
<tr align="center">
<td width="25%">Center</td>
<td valign="top" width="25%">Center - Top</td>
<td valign="middle" width="25%">Center - Middle</td>
<td valign="bottom" width="25%">Center - Bottom</td>
</tr>
</table>

Output
Center Center - Top Center - Middle Center - Bottom