How to center images on a web page for all screen sizes

connor.p picture connor.p · May 5, 2011 · Viewed 235.6k times · Source

I'm having a problem with my HTML. I've searched all over the internet, but still no real answer.

I have a website with some images, and I want them to be in the middle. Now, on my screen they're in the middle, but that's because I've put them there by moving them to one side. When my friends to look at it, the image is off-center.

Here's the website; if you are on a 13.5" screen it will look to be in the middle.

Answer

Thomas Shields picture Thomas Shields · May 5, 2011

Try something like this...

<div id="wrapper" style="width:100%; text-align:center">
<img id="yourimage"/>
</div>