HTMLImageElement.align

Obsolete
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.

The obsolete align property of the HTMLImageElement interface is a string which indicates how to position the image relative to its container. You should instead use the CSS propertiy vertical-align, which does in fact also work on images despite its name. You can also use the float property to float the image to the left or right margin.

The align property reflects the HTML align content attribute.

Syntax

htmlImageElement.align = alignMode;
alignMode = htmlImageElement.align;

Value

A DOMString specifying one of the following strings which set the alignment mode for the image.

Baseline alignment

These three values specify the alignment of the element relative to the text baseline. These should be replaced by using the CSS vertical-align property.

bottom
The bottom edge of the image is to be aligned vertically with the current text baseline. Default value.
middle
The center of the object should be aligned vertically with the current baseline.
top
The top edge of the object should be aligned vertically with the current baseline.

It may be worth noting that vertical-align offers several additional options for its value; you may wish to consider these when changing your code to use it.

Floating images horizontally

The left and right properties don't affect the baseline-relative alignment. Instead, they cause the image to "float" to the left or right margin, allowing the following text to flow around the image. You should instead use the CSS float property, specifying as the value either left or right.

left
Floats the image over to place the left edge flush against the curent margin. Any text that follows will flow against the image's right edge.
right
Floats the image to place its right edge flush against the right margin. Subsequent text will flow along the image's left edge.

Specifications

Specification Status Comment
HTML Living Standard
The definition of 'HTMLImageElement.align' in that specification.
Living Standard
HTML 4.01 Specification
The definition of 'HTMLImageElement.align' in that specification.
Recommendation

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
alignChrome Full support 1Edge Full support 12Firefox Full support YesIE ? Opera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesFirefox Android Full support YesOpera Android ? Safari iOS Full support YesSamsung Internet Android ?

Legend

Full support  
Full support
Compatibility unknown  
Compatibility unknown