+ 2

<img src="......" align="center" /> is not working

alignment of the image is still on the left . when I tried align="right or left" it's working but not working with center

21st Oct 2018, 11:04 AM
Abhishek Gautam
Abhishek Gautam - avatar
10 Answers
+ 6
<img> is an inline element. align only works on block level element like div,p etc.
22nd Oct 2018, 4:41 AM
Michael Phiri
Michael Phiri - avatar
+ 9
or you can use: <p align="center"> <img src="" /> </p>
21st Oct 2018, 1:43 PM
Muhd Khairul Amirin
Muhd Khairul Amirin - avatar
+ 8
In html5, align attribute of img tag is not supported. <center> tag can also have problems. Best way is to use align attribute on a div, p, span or other container and put img inside that. Or use CSS instead.
21st Oct 2018, 6:08 PM
Arushi Singhania
Arushi Singhania - avatar
+ 7
<div align="center"> <img src="image location"/> </div>
22nd Oct 2018, 7:35 AM
Said BAHAOUARY
Said BAHAOUARY - avatar
+ 6
// or else, you can use <center> to make the text or paragraph in center.
21st Oct 2018, 1:57 PM
// Νεχο
// Νεχο - avatar
+ 6
To make the image in center, you must make the display inline in block with <img> element.
22nd Oct 2018, 7:28 AM
// Νεχο
// Νεχο - avatar
+ 5
i had same problem >try this: <center> <img src="......" /> </center>
21st Oct 2018, 11:06 AM
Vashishtha Upadhyay
Vashishtha Upadhyay - avatar
+ 2
vashishth bro your method is working Thanks 🙂
21st Oct 2018, 11:12 AM
Abhishek Gautam
Abhishek Gautam - avatar
+ 2
thanks guys for the help
21st Oct 2018, 11:13 AM
Abhishek Gautam
Abhishek Gautam - avatar
0
$atnam not working bro
21st Oct 2018, 11:10 AM
Abhishek Gautam
Abhishek Gautam - avatar