+ 7

How can we align an image to center in html document

Can't we simply do it like <img align="center" src="photo.jpg" alt="">

2nd Sep 2020, 4:40 AM
Ankit Meena
Ankit Meena - avatar
3 odpowiedzi
+ 11
If you are feeling hard to use css that their another method also use it --- example <p align="center"> <img src=" photo.jpg" > </p> if you use align="center" in img attribute it will not work so use above example
2nd Sep 2020, 9:41 AM
ANMOL
ANMOL - avatar
+ 5
<style> .img-container { text-align: center; } </style> <body> <div class="img-container"> <img src="user.png" alt="Alladin"> </div> </body> I hope you get it. Thanks!
2nd Sep 2020, 4:45 AM
Shaili Shah
Shaili Shah - avatar
+ 3
You can simply add <center> </center> tag ,it will work.
3rd Sep 2020, 7:42 AM
Sujit Kr Singh
Sujit Kr Singh - avatar