align Attribute


 

Where to use the align Attribute


Description

The align attribute specifies the horizontal alignment (or justification) of data within table cells.

Possible values are "left", "center", "right", "justify" and "char" (although neither "justify" nor "char" is available in the *W3C XHTML 1.1 Basic Tables Module).

left
Left-align cell contents
center
Horizontally centre cell contents
right
Right-align cell contents
justify
Justify cell contents (alter word spacing so that both left and right edges of text are aligned) - sometimes called "double justification"
char
Align cell contents at a particular character, specified by the char attribute. I do not know of any browsers which currently support this alignment setting.

In general, although the align attribute is widely supported (except on col and colgroup elements) it is probably best to use the CSS (the text-align property) instead, in order to separate content from presentation.

Note, however, that this CSS alternative is not permitted by the CSS2 Specification when used on col or colgroup elements. This means that each individual cell within a column must be aligned separately to achieve the desired appearance in any user agents (most notably Firefox) which do not support the align attribute on col or colgroup. In fact, the only CSS properties which may be used when styling col or colgroup elements are: width, background, border and visibility. Ref: *CSS2 Specification: Column selectors.

See also the valign attribute.


Page Footer & Copyright

Copyright © Sally Maughan 2005-2009 (Page last updated on 16 May 2009)

*Valid XHTML 1.1 - hosted by *Openstrike

Content based on the W3C Working Draft: *XHTML 1.1 and Recommendation: *XHTML Modularisation 1.1.

W3C, XHTML, XML, HTML, CSS and MathML are *Trademarks of the W3C (*MIT, *ERCIM, *Keio) with which the site's author has no connection.


Up, Next & Previous Links

Your Location

Home > XHTML 1.1 Home > XHTML 1.1 Indexes > Attribute Index (XHTML 1.1) > align Attribute (XHTML 1.1)