w3schools
  
HOME HTML CSS XML JAVASCRIPT ASP PHP SQL MORE...   References Examples Forum About

HTML Reference

HTML by Alphabet
HTML by Function
HTML Attributes
HTML Events
HTML Valid DTDs
HTML Colornames
HTML Colorpicker
HTML Colormixer
HTML Character Sets
HTML ASCII
HTML ISO-8859-1
HTML Symbols
HTML URL Encode
HTML Lang Codes
HTTP Messages

HTML Tags

<!-->
<!DOCTYPE>
<a>
<abbr>
<acronym>
<address>
<applet>
<area>
<b>
<base>
<basefont>
<bdo>
<big>
<blockquote>
<body>
<br>
<button>
<caption>
<center>
<cite>
<code>
<col>
<colgroup>
<dd>
<del>
<dfn>
<dir>
<div>
<dl>
<dt>
<em>
<fieldset>
<font>
<form>
<frame>
<frameset>
<head>
<h1> - <h6>
<hr>
<html>
<i>
<iframe>
<img>
<input>
<ins>
<kbd>
<label>
<legend>
<li>
<link>
<map>
<menu>
<meta>
<noframes>
<noscript>
<object>
<ol>
<optgroup>
<option>
<p>
<param>
<pre>
<q>
<s>
<samp>
<script>
<select>
<small>
<span>
<strike>
<strong>
<style>
<sub>
<sup>
<table>
<tbody>
<td>
<textarea>
<tfoot>
<th>
<thead>
<title>
<tr>
<tt>
<u>
<ul>
<var>

HTML <img> align Attribute

HTML img Tag Reference 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

Internet Explorer Firefox Opera Google Chrome Safari

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

<img align="value" />

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 Reference HTML <img> tag

1,050,724 Sites built with Wix. Make your own!

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.


WEB HOSTING
Best Web Hosting
PHP MySQL Hosting
Top 10 Web Hosting
UK Reseller Hosting
Web Hosting
FREE Web Hosting
Top Web Hosting
Windows Hosting
WEB BUILDING
Download XML Editor
FREE Flash Website
FREE Web Templates
FLIGHT TICKETS
Find the cheapest flight
to any destination now!
EDUCATION
US Web Design Schools
HTML Certification
JavaScript Certification
XML Certification
PHP Certification
ASP Certification
STATISTICS
Browser Statistics
Browser OS
Browser Display