Skip to: content, navigation

by Ian Lloyd

align (HTML attribute)

Spec
Depr. Version
No HTML 4
Browser support full matrix
IE5.5+ FF2 Saf3 Op9.2+
Full None None Full
align=" { center | char | justify | left | right } "

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>

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).

Value

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

Compatibility

IE5.5Full
6.0Full
7.0Full
Firefox1.0None
1.5None
2.0None
Safari1.3None
2.0None
3.0None
Opera9.2Full
9.5Full

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.

Add a note

To post a note on this topic, please log in with your SitePoint username and password. If you don't have an account yet, you can create a new account for free.

Related Products

The Principles of Beautiful Web Design

Best Seller!

You don’t need to go to Art School to design great looking web sites!

Book Cover: The Principles of Beautiful Web Design

Download the FREE sample chapters