HTML <input> alignAttribute

HTML input 标签参考手册HTML <input> Tag

Examples

An HTML form with an image submit button, aligned to the right:

<form action="demo_form.html">
  First name: <input type="text" name="fname"><br>
  <input type="image" src="submit.gif.html" alt="Submit" align="right"
  width="48" height="48">
</form>

Try it Yourself »

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

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


Definition and Usage

HTML5 does not support the <input> align attribute. Please use CSS instead.

In HTML 4.01, the align attribute of <input>Deprecated。

The align attribute can only be used with <input type="image">. It specifies the alignment of the image input relative to surrounding elements.


Compatibility Notes

In HTML 4.01, the align attribute of <input> is deprecated. Please 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 aboutthe float property.


Syntax

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

Attribute Values

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


HTML input 标签参考手册HTML <input> Tag Other Extensions