THE WORLD'S LARGEST WEB DEVELOPER SITE

HTML <input> align Attribute

❮ HTML <input> tag

Example

An HTML form with an image as a submit button. The submit button is aligned to the right:

<form action="/action_page.php">
  First name: <input type="text" name="fname"><br>
  <input type="image" src="submit.gif" alt="Submit" align="right" width="48" height="48">
</form>
Try it Yourself »

Definition and Usage

The align attribute is only used with <input type="image"> and it specifies the alignment of the image input according to surrounding elements.


Browser Support

Attribute
align Yes Yes Yes Yes Yes

Note: Only the "left" and "right" values of the align attribute work properly in all major browsers.


Compatibility Notes

The align attribute of <input> is not supported in HTML5. Use CSS instead.

CSS syntax: <input type="image" style="float:right">

CSS Example: align input image

In our CSS tutorial you can find more details about the float property.


Syntax

<input align="left|right|middle|top|bottom">

Attribute Values

Value Description
left Left-aligns the image (this is default)
right Right-aligns the image
top Top-aligns the image
middle Middle-aligns the image
bottom Bottom-aligns the image

❮ HTML <input> tag