align (HTML attribute)

Spec
Depr. Version
No HTML 2
Browser support (more…)
IE5.5+ FF1+ SA1.3+ OP9.2+ CH2+
Partial Partial Partial Partial Partial

Syntax

align=" { center | char | justify | left | right } "

Description

The align attribute can be used in most table elements, and the table row—or tr—is no exception. The value set at the table-row level is then inherited by the th and td elements it contains (unless they, too, are set to a specific alignment).

Once again, it should be noted that setting the alignment using this HTML attribute is not ideal. Use CSS to perform the job.

Example

The th elements’ default alignment ("center") is overridden at the tr level, to become "left":

<table summary="Interest Rates" width="400" border="1">
  <caption>Interest Rates</caption>
  <thead>
    <tr align="left">
      <th>Account Type</th>
      <th>Interest Rate</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Smart</td>
      <td>From 2%</td>
    </tr>
    <tr>
      <td>Young Saver</td>
      <td>From 1.6%</td>
    </tr>
  </tbody>
</table>

Value

The recognized attribute values are as shown in the syntax section.

Compatibility

Internet Explorer Firefox Safari Opera Chrome
5.5 6.0 7.0 8.0 1.0 1.5 2.0 1.3 2.0 3.1 4.0 9.2 9.5 10.0 2.0
Partial Partial Partial Partial Partial Partial Partial Partial Partial Partial Partial Partial Partial Partial Partial

In the browsers tested, the "left", "right", "center", and "justify" alignments were honored, but the "char" value—used alongside the char and charoff attributes—was ignored by all (or incorrectly interpreted as "center").

User-contributed notes

There are no comments yet.

Related Products