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

How to align an image?

I typed: <body> <img src="logo.png" align="center" border="1px" width="20%" alt=""> <h2 align="center"> The Title </h2> But the image didn't move from the corner to the center. I think it is because of header. When I type align="left" the image and header lie straightly. But the header move right a little. How can I fix this?

18th Oct 2016, 5:27 AM
Htet Oo Wai Yan
Htet Oo Wai Yan - avatar
2 Answers
+ 2
style="align-content: center;" inside the tag should work
18th Oct 2016, 5:45 AM
Fronz-Tec
Fronz-Tec - avatar
0
<p align="center"> <img src="logo.png" alt=""/> <h2>The Title</h2> </p>
18th Oct 2016, 7:58 AM
Aung Aung
Aung Aung - avatar