HTML | <input> align Attribute

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

Syntax:

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

Attribute Values:



  • left: It sets the alignment of image to the left.
  • right: It sets the alignment of image to the right.
  • middle: It sets the alignment of image to the middle.
  • top: It sets the alignment of image to the top.
  • bottom: It sets the alignment of image to the bottom.

Example 1:

filter_none

edit
close

play_arrow

link
brightness_4
code

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

chevron_right


Output:

Example 2:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!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>
        Email_id:
        <!--Here type="text" align will not work-->
        <input type="text" alt="mail_id" align="right">
        <input type="image" src=
                     alt="GeeksforGeeks" align="right">
    </div>
</body>
  
</html>

chevron_right


Output:

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

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Safari
  • Opera


My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.