Deprecated in HTML5. Do not use.

<tr align="">

Disclosure: Your support helps keep the site running! We earn a referral fee for some of the services we recommend on this page. Learn more
Attribute of
Code Example For Tr In HTML (To Organize Table Rows)
What does <tr align=""> do?
Sets the horizontal alignment for the contents of each <td> element in a table row.

Code Example

<table>
  <tr align="center">
    <td>First column</td>
    <td>Second column</td>
    <td>Third column</td>
  </tr>
  <tr align="right">
    <td>First column</td>
    <td>Second column</td>
    <td>Third column</td>
  </tr>
  <tr align="left">
    <td>First column</td>
    <td>Second column</td>
    <td>Third column</td>
  </tr>
</table>
First columnSecond columnThird column
First columnSecond columnThird column
First columnSecond columnThird column

How to Control Table Cell Alignment

The align attribute was once used to control the alignment of every <td> element contained in a <tr>. Three values were used most commonly with the attribute: left, right, and center. Justify and char could also be used, but were used much less frequently. This attribute has been deprecated. Instead of using the align attribute the CSS property text-align should be used. For example, we can recreate the table from the example at the top of this page with CSS instead of the align attribute.

<style> .first-row {   text-align: center; } .second-row {   text-align: right; } .third-row {   text-align: left; } </style> <table>   <tr class="first-row">     <td>First column</td>     <td>Second column</td>     <td>Third column</td>   </tr>   <tr class="second-row">     <td>First column</td>     <td>Second column</td>     <td>Third column</td>   </tr>   <tr class="third-row">     <td>First column</td>     <td>Second column</td>     <td>Third column</td>   </tr> </table> 

When we render that HTML in the browser, we will get the exact same table as was produced in the initial example.

.first-row{text-align: center;}.second-row{text-align: right;}.third-row{text-align: left;}

First columnSecond columnThird column
First columnSecond columnThird column
First columnSecond columnThird column
Adam is a technical writer who specializes in developer documentation and tutorials.