Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML img align attribute

HTML The align attribute

HTML img Tag Reference HTML tag

Example

Setting the alignment of an image within text:

This is some text. Smiley face This is some text.

Try it »


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the align attribute.


Definition and Usage

HTML5 does not support the align attribute. Please use CSS instead.

In HTML 4.01, The align attribute is deprecated.

The align attribute specifies the alignment of the image relative to surrounding elements.

The element is an inline element (it does not insert a new line on the page), which means that text and other elements can surround it. Therefore, the align attribute can help us specify the alignment of the image relative to surrounding elements.


Compatibility notes

In HTML 4.01, The align attribute is deprecated. Please use CSS instead.

CSS syntax:

CSS example: floating an image to the right

In our CSS tutorial, you can find more details about The float attributedetails.


Syntax

Attribute values

Value Description
left Align the image to the left.
right Align the image to the right.
middle Align the image to the center.
top Align the image to the top.
bottom Align the image to the bottom.

HTML img Tag Reference HTML tag