align (HTML attribute)

Spec
Depr. Version
No HTML 4
Browser support (more…)
IE5.5+ FF2 SA4 OP9.2+ CH2
Full None None Full None

Syntax

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

Description

While it’s possible to set the alignment of text at th and td level—and alignment is well supported for those elements—it does mean repeating the align attribute for every row. Applying align to a col element avoids this overhead (or rather, it should).

Example

This example shows text alignments set on col elements:

<table border="1">
  <col align="left"/>
  <col align="center"/>
  <col align="right"/>
  <col/>
  <tr>
    <th colspan="4" scope="col">Work Contact Points</th>
  </tr>
  <tr>
    <th>Name sfdg sfg sdfg  sdfg sdfg sfsgsdf gs</th>
    <th>Email</th>
    <th>Phone</th>
    <th>Floor/Block</th>
  </tr>
  ⋮
</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
Full Full Full Full None None None None None None None Full Full Full None

Compatibility for col’s align attribute is very poor, as the support chart shows (this time, it’s IE and Opera who are the good guys!). As such, this attribute can’t be relied upon, nice as the idea is.

User-contributed notes

There are no comments yet.

Related Products