HTML <img> alignAttribute
Example
Set the alignment of an image in text:
Try it Yourself »
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the align attribute.
Definition and Usage
HTML5 does not support the <img> align attribute. Use CSS instead.
In HTML 4.01, the align attribute of <img>is deprecated。
The align attribute specifies the alignment of an image relative to surrounding elements.
The <img> element is an inline element (it does not insert a new line on the page), which means text and other elements can wrap around it. Therefore, the align attribute helps us specify the alignment of the image relative to surrounding elements.
Compatibility Notes
In HTML 4.01, the align attribute of <img> is deprecated. Use CSS instead.
CSS syntax: <img style="float:right">
CSS Example: Float an image to the right
In our CSS tutorial, you can find more details aboutthe float propertydetails.
Syntax
Attribute Values
| Value | Description |
|---|---|
| left | Aligns the image to the left. |
| right | Aligns the image to the right. |
| middle | Aligns the image to the center. |
| top | Aligns the image to the top. |
| bottom | Aligns the image to the bottom. |
HTML <img> Tag Other Extensions