Since we can only use Markdown and a limited subset of HTML/CSS is it possible to center an image, or any block element for that matter, on the Stack Exchange sites?
Tables can actually center content
The relatively recent introduction of table formatting provides a way to actually center an image or other content. However, doing so results in additional table formatting around the image (a header row and borders), but it does actually center something, regardless of the width of the user's window. Unfortunately, using formatting like
, or other formatting/characters to push content a set distance to the right in order to "center" something can't take into account that users can choose the width of the window, making the "centering" using
, etc. to be substantially off from being centered.
Using colons as part of the header/content separator,
|:----:|, is what results in the cell being centered. With only one cell in the table, the entire content is centered within the post.
|| |:----:| |[![Artist concept image of "the newly forming exoplanet PDS 70b"]]<br><sub>[image credit: NASA, ESA, STScI, Joseph Olmsted (STScI)](https://www.nasa.gov/feature/goddard/2021/hubble-watches-how-a-giant-planet-grows)</sub>|
Random 470×320 px image:
You can add artificial margins directly into the image, if you don't mind, that they will be preserver proportionally, so the graphics itself will be very small on small displays.
Modified image, canvas extended to 1600×320:
(This is suboptimal solution, centering feature wanted.)