Open In App

HTML <input> align Attribute

Improve
Improve
Like Article
Like
Save
Share
Report

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:

html




<!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:

html




<!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:

Screenshot-2023-12-20-161257Supported Browsers:

  • Google Chrome 1
  • Microsoft Edge 12
  • Firefox 1
  • Opera 12.1
  • Safari 1


Last Updated : 17 Jan, 2024
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads