Open In App

HTML <input> align Attribute

The HTML <input> align attribute is used with <input type=” image”> to set the horizontal alignment of the image. It is not supported by HTML 5.

Note: Since <input type=” image”> is not supported by HTML5 you can use CSS there instead of this attribute. The syntax for CSS <input type=”image” style=”float: right”>.



Syntax:

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

Attribute Values:

Attribute Values

Description

left

It sets the alignment of the image to the left. it is a default value.

right

It sets the alignment of the image to the right.

middle

It sets the alignment of the image to the middle.

top

It sets the alignment of image to the top.

bottom

It sets the alignment of image to the bottom.

Example1:




<!DOCTYPE html>
<html>
 
<head>
    <title>
        HTML input align Attribute
    </title>
</head>
 
<body>
    <h1 style="color:green;">
      GeeksforGeeks
      </h1>
 
    <h3>
      HTML input align Attribute
      </h3>
 
    <input type="image" src=
           alt="GeeksforGeeks logo"
           align="right">
</body>
 
</html>

Output:



Example 2:




<!DOCTYPE html>
<html>
 
<head>
    <title>
        HTML input align Attribute
    </title>
</head>
 
<body>
    <center>
        <h1 style="color:green;">
          GeeksforGeeks
          </h1>
 
        <h3>
          HTML input align Attribute
          </h3>
    </center>
    <div>
 
        <input type="image" src=
               alt="GeeksforGeeks" align="right">
    </div>
</body>
 
</html>

Output:

Supported Browsers:


Article Tags :