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.
4 Answers
+ 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;
}
0
<p align="center">
<img src="a.jpg" alt="Image" width="50%" height="50%" border="10%"/>
</p>.
0
<center><Img src=""></center>