HTML <img> align attribute is used to set the alignment of an image. It is an inline element. It is used to specify the alignment of the image according to surrounding elements.
It is not supported by HTML 5. HTML 5 uses CSS property instead of this attribute.
Syntax:
<img align="left|right|middle|top|bottom">
Attribute Values:
- left: It sets the alignment of the image to the left.
- 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 the image to the top.
- bottom: It sets the alignment of the image to the bottom.
Example 1: In this example, we are aligning the image left and right.
html
<!DOCTYPE html>
< html >
< head >
< title >
HTML img align Attribute
</ title >
</ head >
< body >
< h1 >GeeksforGeeks</ h1 >
< h2 >HTML img align Attribute</ h2 >
< img src =
alt = "GeeksforGeeks logo"
align = "right" >
< img src =
alt = "GeeksforGeeks logo"
align = "left" >
</ body >
</ html >
|
Output:

Example 2: In this example, we are aligning the image in center.
HTML
<!DOCTYPE html>
< html >
< head >
< title >
HTML img align Attribute
</ title >
</ head >
< body >
< h1 >GeeksforGeeks</ h1 >
< h2 >HTML img align Attribute</ h2 >
< img src =
align = "center" >
</ body >
</ html >
|
Output:

center alignment
Supported Browsers: The browser supported by HTML <img> align Attribute are listed below:
- Google Chrome
- Internet Explorer
- Firefox
- Safari
- Opera
HTML is the foundation of web pages, is used for webpage development by structuring websites and web apps. You can learn HTML from the ground up by following this HTML Tutorial and HTML Examples.
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape,
GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out -
check it out now!
Last Updated :
24 Nov, 2023
Like Article
Save Article