Skip to content
Related Articles

Related Articles

Improve Article
HTML | <input> align Attribute
  • Last Updated : 28 Jun, 2019

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:




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

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
Recommended Articles
Page :