You are here: Reference > HTML > attributes > align (hr, iframe, marquee, table)

align attribute (hr, iframe, marquee, table)

Browser support:
Sets the horizontal alignment of an object relative to its parent.
This attribute is deprecated. Use the vertical-align style property instead.
JavaScript page for this attribute: align. You can find other example(s) there.

Possible values:

String that sets the type of alignment.
One of the following values:
center
Aligns the table to the center of the document. Same as middle.
left
Aligns the table to the left of the document.
middle
Aligns the table to the center of the document. Same as center.
right
Aligns the table to the right of the document.
Default: this attribute has no default value.

Example HTML code 1:

This example illustrates the use of the align attribute:
The following table is aligned to the center:
<table border="1px" style="width:200px;" align="center">
    <tr>
        <td>First cell.</td>
        <td>Second cell.</td>
    </tr>
</table>
Did you find this example helpful? yes no

Example HTML code 2:

Recommendation:
<div style="text-align:center;">
    <table border="1px" style="width:200px; text-align:left;">
        <tr>
            <td>First cell.</td>
            <td>Second cell.</td>
        </tr>
    </table>
</div>
Did you find this example helpful? yes no

Supported by tags:

External links:

User Contributed Comments

Post Content

Post Content