0

How do you center the image on a page?

I've been looking it up for like an hour, and I can't figure it out anywhere.

14th Feb 2017, 10:24 PM
Sam
Sam - avatar
4 odpowiedzi
+ 1
In your css for horizontal centering. img tag has a display type of inline-block by default. This will usually need to be changed to block. Then setting your left/right margins to auto will even out the available spacing for each side of the element. If you need to, you can change the top/bottom margins to whatever is needed. Keep in mind that this centers the img in the parent element. img { display: block; margin: 0 auto; }
15th Feb 2017, 12:41 AM
ChaoticDawg
ChaoticDawg - avatar
0
<p align="center"> <img src="a.jpg" alt="Image" width="50%" height="50%" border="10%"/> </p>.
14th Feb 2017, 11:42 PM
Chandan Kumar Y S
Chandan Kumar Y S - avatar
0
<center><Img src=""></center>
15th Feb 2017, 7:23 AM
Aswin anand cl
Aswin anand cl - avatar