Table Align

Align attribute of Table can positioning Tables and their contents in relation to other elements on the Web page. Align attributes can be set in two levels, Table Alignment and the alignment of content inside the Table Cells.

How to Align HTML Table

Alignment of the Html Table element defines the horizontal alignment of the Table inside the next outer container. This does not control the alignment of the contents inside the cells of a Table. You can Align an HTML Table left, right, and center horizontally inside the next outer container.

<table border="1" align="right">

The above code will align the Table at the right side of the next outer container.


In the above picture you can see three tables align left, center, and right respectively.

HTML Source Code :

<html> <body > <table border="2" align="left"> <tr><td>Table 1</td></tr> <tr> <td>Align Left</td> </tr> </table> <br><br><br> <table border="2" align="center"> <tr><td>Table 2</td></tr> <tr> <td>Align Center</td> </tr> </table> <br> <table border="2" align="right"> <tr><td>Table 3</td></tr> <tr> <td>Align Right</td> </tr> </table> </body> </html>

Note: The align attribute is supported in all major browsers, but it is deprecated in HTML 4.01.