align (HTML attribute)

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

Syntax

align=" { bottom | left | middle | right | top } "

Description

The align attribute is used to specify how the image sits on the page in relation to surrounding text and other elements. It is a fairly rudimentary attribute—and a very presentational one—that allows you to move an image to the right or left, with text wrapping around it accordingly (although without surrounding whitespace, which generally produces quite an ugly result). You can also alter the adjacent text alignment so that the first line of the text aligns with the top, middle, or bottom of the image.

The example markup shown with a right-aligned image would appear as shown in Figure 1.

Figure 1. A right-aligned image Right-aligned image

If the value were changed to "top", the effect would be very different, as Figure 2 shows.

Figure 2. An image for which align is set to "top" Image with align set to top

As the two examples show, the align attribute is no precision instrument when it comes to layout!

If an img is aligned "left" or "right", text will continue to wrap around it until it encounters either:

  • a br element with a clear attribute
  • any other element whose CSS clear property is set to "left", "right", or "both"

Example

The align attribute for this img is set to "right":

<p><img src="giant-prawn.jpg" alt="The Giant Prawn at Ballina"
    align="right"/>Driving along, we spotted a giant prawn, so had to
    stop and take a closer look.</p>

Value

"bottom", "left", "middle", "right", and "top" are the values that this attribute may take.

Nonstandard, proprietary attributes (which are still supported by Internet Explorer) that are acceptable include "absbottom", "absmiddle", "baseline", and "texttop".

Compatibility

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

This attribute is now deprecated, and is highly presentational in its nature. The desired visual effects can all be achieved with CSS and, as such, this attribute shouldn’t be used—it’s presented here for informational purposes only.

User-contributed notes

There are no comments yet.

Related Products