How to align image to the middle? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to align image to the middle?

Image is not getting aligned in the middle. i tried by using <img src=" " align="middle" alt=" "/ >

9th Sep 2020, 1:04 PM
Pranish Sharma
Pranish Sharma - avatar
4 Answers
+ 5
for learning purpose only. Try this: <p align="center"><img src="" alt="image"></p> https://code.sololearn.com/W3Z0B8flzRLk/?ref=app https://code.sololearn.com/W1h0C543y4Gn/?ref=app
9th Sep 2020, 1:07 PM
Rohit
+ 2
Thanks
9th Sep 2020, 1:13 PM
Pranish Sharma
Pranish Sharma - avatar
+ 1
img{ display:block; margin:auto; }
9th Sep 2020, 1:34 PM
Divya Mohan
Divya Mohan - avatar
+ 1
You can use this way to align it on the middle of any device's img{ position: absolute; top: 50%; left: 50%; transform:translate(-50%, -50%); }
11th Sep 2020, 10:19 AM
KARTHIK
KARTHIK - avatar