HTML <table> alignAttribute

HTML table 标签参考手册HTML <table> tag

Examples

A right-aligned HTML table:

<table border="1" align="right">
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr>
<td>January</td>
<td>$100</td>
</tr>
<tr>
<td>February</td>
<td>$80</td>
</tr>
</table>

Try it Yourself »

Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the align attribute.


Definition and usage

HTML5 does not support the <table> align attribute. Use CSS instead.

In HTML 4.01, the align attribute of <table>is deprecated。

The align attribute specifies the alignment of a table relative to the surrounding text.

Normally, line breaks appear before and after an HTML table. By using the align attribute, you can have other HTML elements wrap around the table.


Compatibility notes

In HTML 4.01, the align attribute of <table> is deprecated. Use CSS instead.

CSS syntax: <table style="float:right">

CSS example: Table alignment

In our CSS tutorial, you can find more details about thefloat propertydetails.


Syntax

<table align="left|right|center">

Attribute values

Value Description
left Left-aligns the table.
right Right-aligns the table.
center Center-aligns the table.


HTML table 标签参考手册HTML <table> tag Other extensions