2

I recently wrote up this Q&A to show a method on how to center images from the CLI using ImageMagick - How can I center a PNG with a transparent background using the CLI?.

Through the course of discussions in comments on that question it started to become obvious that within the various SE communities there are differing opinions on whether images should be indented/centered within a post or left justified.

StackExchange provides no assistance in this department by continuing to ignore this issue across all SE properties, IMO:

So I'm wondering if this community has any opinions on this topic and if we as a community should try and form some consensus on this?

2

I disagree that images should be centred by adding blank space to the image. Since the mobile site centres images automatically, adding this transparent space just reduces the size of the image, making it even harder to read on a mobile device. Unlike many other communities, Ask Different is heavily used on mobile devices with its focus on iOS questions and answers.

                                        

However, that doesn't mean images can't be centred. Something I occasionally use where centring an image makes sense is non-breaking spaces, either literally entered into the text (with a replacement or macro) or with the HTML encoding  . Inserting these spaces before the image moves the image along to the right, so a different number of spaces is needed depending on the size of the image.

However the benefit of this is that this does not reduce the size of the image on mobile — it is still displayed in its natural size horizontally centred using the automatic CSS centring provided on the mobile site without any reduction of size.

I used this latter technique to centre the screenshot in this post; open this on your phone to see the image still centred but shown full size, unlike the image in the content of the screenshot.

  • That's the method I was using but got it edited out of my post twice 8-). – slm Apr 23 at 15:03
  • 1
    @slm Ah I was wondering what prompted this Q&A and I think I just found it. I'm interested what the reasoning behind those edits were, I'll ping them in chat and point them to this Q&A. – grg Apr 23 at 15:07
  • Seems to me that nearly all SE sites are primarily read on phones or watches. // Images are often too big (load time etc), merely ornamental… in short: images should not be centered at all. My +1 one is for the very first sentence of this A. – LаngLаngС Apr 23 at 16:35
  • @LangLangC - do you disagree w/ centering for browser consumption, I never use the mobile app to consume SE. – slm Apr 23 at 18:29
  • @slm I'd say that an option that enables such a rendering might be aesthetically pleasing, semantically helpful. If there is no way to instruct SE rendering to do that, I only know detrimental options to enforce that (adding hard white space border would be terrible, adding too much formatting by hand-code as well). Perhaps I do not know enough about this, but rendering quirks and defects of SE should be left standing, not in the least to make them engage in fixing them. – LаngLаngС Apr 23 at 18:58
  • @grg the SE app on Android does not auto center either. – slm Apr 23 at 22:54
  • The theme used when visiting SE from Mobile Safari Centers automatically. Posts with manual centering look rather strange then. – nohillside Apr 24 at 4:52
  • 2
    Also, even if the consensus should be that centering is ok, please don‘t edit answers just to center an image! – nohillside Apr 24 at 4:54
  • @LangLangC I really doubt that. I almost never use my phone for SE, for example. I'm sure many people do, but I really don't think you can generalize to " nearly all SE sites are primarily read on phones", let alone watches! Very few people have smart watches, after all. I expect this site will indeed often be read on mobile, but I doubt that most visitors to SO are on mobile, for example. Far more likely that they're on their computer at work. – terdon Apr 24 at 13:24
  • @terdon Without hard data on this I only ever see complaints from "mobile" users, links to mobile versions of sites, etc… The point here is that the backend has to take care of the different actual renderings, for mobile or 'real device' (layout, perhaps with selectable options), the authors do the content (incl structure, but not micro-layout; just like good LaTeX, only without orienting layouts to paper/PDF, but screens of varying sizes). – LаngLаngС Apr 24 at 13:30
1

As far as I understand this issue as presented, we should not even offer any style guide in that particular direction (others: maybe).

But the core problem is already exemplified within the question:

StackExchange provides no assistance in this department by continuing to ignore this issue across all SE properties,…

Posts on this site and others across SE have numerous problems regarding good layout that may be overcome by going to lengths by authors.

I tried that in a few, and it's mainly backbiting experience, waste of time and more importantly: if it's going to be fixed at the root, it was all for nothing, actually detrimental.

One example Incorrect spacing around headers almost 4 years in the inbox, not fixed. If we start to workaround this now, with formatting tricks, we counter the intuitiveness of mark down by making it more complicated and if the feature request is granted, then all posts looking 'better' now will look not nice.

The place to request such options is https://meta.stackexchange.com/

  • 1
    Very good points! – slm Apr 23 at 18:28
-2

Background

In my opinion reading technical material is much more pleasant and easier to digest when the document has a good flow to it. Having paragraphs of text and images all left justified muddies up this flow by not allowing for enough white space around to break up the document in a reasonable way.

I've written and read a lot of Latex style documents, users guides from companies for this product or that product and I've always found that images , diagrams, and tables are centered on the page, not left justified.

Given that SE is a technical document platform, I'd argue that the content we create on these SE sites is technical in nature and should therefore follow these same principles.

Examples

I've worked in the CAD/CAM and Internet businesses for the better part of 20+ years and it's been my experience that technical documents always indent/center images, diagrams, and tables.

I'll cite some examples to illustrate this but it would be trivial to produce 100's of these examples if needed.

pg. 43 - Modelsim User's Guide

ss

pg. 52 - Modelsim User's Guide

ss

Overleaf - Style Guide

ss

Text Formatting with LATEX A Tutorial Academic and Research Computing, April 2007

ss

Final Thoughts...

Obviously could go on but these are some examples from that I've encountered throughout my career. Granted others will have different paths but was curious what other's opinions were on the matter and if we wanted to come to come agreements on how to deal with this as a community.

You must log in to answer this question.

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