Centering an image

How to centre an absolutely positioned image on a webpage using CSS.

The trick is to set the left margin to a negative number, this number should be half of the width of your image.

#LogoImage
{
position : absolute;
left : 50%;
top : 0px;
margin-left: -200px;
}

 

Share this article!

Follow us!

Find more helpful articles: