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 <img> is deprecated, and
is not supported in HTML 4.01 Strict / 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

Need an easy way to get data into XML, or transform XML to another format?
MapForce lets you map XML data to/from any combination of XML, database, flat file, Excel 2007, XBRL, or Web services data.
Then it transforms data instantly or auto-generates royalty-free data integration code for recurrent conversions.
New features in Version 2010!
Download a free, fully functional 30-day trial to experience the following features:
- Easy-to-use, graphical data mapping interface
- Instant data transformation
- XSLT 1.0/2.0 and XQuery code generation
- Java, C#, and C++ code generation
- Advanced data processing functions
- Support for all major relational databases including SQL Server, IBM DB2, Oracle, and more
- Visual Studio & Eclipse integration
Download a fully-functional trial today!
|
|
|
|