HTML <img> align Attribute
HTML <img> tag
Example
Align the image in the middle of a text:
| <p><img src="logo_w3s.gif" alt="W3Schools.com"
align="middle" />This is some text. This is some text. This is some
text.</p> |
Try it yourself »
|
Definition and Usage
The align attribute specifies the horizontal and vertical alignment of an image according to the surrounding element.
The img element is an inline element (it does not insert a new line on a page), meaning that text and other elements can wrap around it. Therefore, it can be
useful to specify the alignment of the image according to surrounding elements.
Browser Support

The align attribute is deprecated, but still supported in all major browsers.
Compatibility Notes
The align attribute of the img element was deprecated in HTML 4.01,
and is not supported in XHTML 1.0 Strict DTD.
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 about the float property.
Syntax
Attribute Values
| Value |
Description |
| left |
Align the image to the left |
| right |
Align the image to the right |
| middle |
Align the image in the middle |
| top |
Align the image at the top |
| bottom |
Align the image at the bottom |
HTML <img> tag
Click here to design a Stunning Flash Website for Free
Wix is a revolutionary web design tool that provides anyone with the possibility to create professional and beautiful websites for free.
With e-commerce features, search engine visibility and many more professional tools, Wix is the ultimate solution for creating a spectacular site while saving tons of money.
|