Currently when an image is inserted/linked into any question or answer it goes to the left side. Even the <center> HTML tag doesn't works for this. It would be good if the images stays at center.

  • It's a feature. Imagine some users centering all their text, just because they can.
    – Daniel Beck Mod
    Apr 3, 2012 at 18:46

2 Answers 2


Alternatively, center your image before using an image editing application. Take 640 px (roughly) as the width of the answer div.

  • 1
    FYI: images always have a max-width: 640px; applied to them, so use 640px as the width. If you're really pedantic about getting the image in the exact center remember that it will effectively have a 20px margin on the right, so offset slightly to compensate. I suspect this will also have negative ramifications for mobile and other small-screen devices.
    – DMA57361
    Apr 3, 2012 at 11:20
  • Ah, fair enough! Just a hack anyway...
    – slhck
    Apr 3, 2012 at 11:37
  • Indeed, as was my suggestion. :)
    – DMA57361
    Apr 3, 2012 at 13:08
  • 1
    @DMA57361 I just tested on slhck's image hack: on the mobile version of the site, it's still centred. Granted, the whole thing is shrunk to the point of barely-readable with the same proportion of whitespace to keep it centred, which is why I typically make the image a link to the picture in my answers.
    – Bob
    Apr 13, 2012 at 17:53

There's no way to centre an image that isn't a bit hackish, it's not functionality that is provided.

If you really must, you could just precede the image by a load of &nbsp; - or wrap the image in <pre> tags and use normal spaces - to manually add spacing to give the appearance of the image being centred (see this MSO post for examples).

However, this might cause problems for viewers on mobile devices and maybe tablets (not tested, but I just have a suspicion...), so I'd actually advice against this - just leave the images where they are.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .