11

For some time I've noticed that whenever I used ` grave characters to delimit snippets of code in a mono-spaced font in my answer inline with regular text, it had a side-effect of also adding an extra space before and after the snippet:

for example this here vsthis heremixed in with regular text.

For a long time I ignored it, but eventually began intentionally removing any regular space characters that occurred before and after the fragment to compensate.

Recently someone edited one of my answers and put the spces I had removed back in. In the discussion that followed in the comments, it was discovered that the addition of these extra spaces might be browser-dependent — which implied that my taking them out might not always be appropriate.

There has already been a fairly lengthy discussion in a related question here on meta with some suggesting that it might be due to a css issue. I realize that these kind of issues can be addressed by ccs overrides, I'm not eager to go that route.

My primary browser already has way too many extensions running, so I hesitate to add yet another, set up it, and then have to maintain it and the customizations it would allow me to do.

Is it just me or does this bother anyone else? Are there any (reasonable) recommended methods that can be used to address this, is it intentional, or is it simply a bug?

Please try to avoid rehashing any subject already beaten-to-death in the linked meta discussion.

BTW, several people have suggested that I just override the css style sheet if I don't like how things look in my browser. Beside being loath to get into doing that sort of thing, it misses the motivation behind me doing this in the first place, which was to make my answers look better for most folks, the vast majority of whom likely haven't done something like that themselves.

8
  • 7
    I don't see "extra spaces", but I do see a 5px horizontal padding. You may be confusing that padding with spaces. It's a pure CSS issue, adding a rule like p code { padding: 1px; } would "solve" the issue. Commented Jan 14, 2015 at 13:26
  • @FrédéricHamidi: Hmmm, sounds intentional. Personally I'd prefer padding: 0px;. Using a mono-spaced font is good enough in my opinion -- and the way it is in most if not all of my printed technical books and publications (remember them?) Although the ActiveState web site seems to do it (add space) too -- perhaps simply because they use the same markdown engine.
    – martineau
    Commented Jan 14, 2015 at 13:52
  • 1
    Yup, I believe it is intentional, probably to make the background color visible on each side of the text. You can still create a custom CSS rule on your side, though. Commented Jan 14, 2015 at 13:56
  • 1
    The background + padding combined makes it really obvious that it's an in-line code snippet. It would make sense that this was intentional, to improve readability (as I mentioned before) as people read questions/answers. Commented Jan 14, 2015 at 20:13
  • @Kevin: I personally think improving the readability of in-line code snippet by making them stand out more is a non-problem, and in fact to do so by adding extra space around them makes them look bad as in less readable. Regardless we can only speculate on the original style sheet author's intentions (and what browsers they tested it in).
    – martineau
    Commented Jan 14, 2015 at 20:36
  • 1
    Given that this may be browser-dependent as you say, it could really benefit from a screenshot. I see a perfectly ordinary (and easy-to-read) amount of space. Commented Jan 15, 2015 at 5:53
  • 1
    @chris: Seems like elaborating my example to show it done both ways -- as I've done now -- would be as good as a screenshot, no?
    – martineau
    Commented Jan 15, 2015 at 9:50
  • @martineau Yes, that shows the difference (at least for me). Thanks. Commented Jan 15, 2015 at 18:33

0

You must log in to answer this question.

Browse other questions tagged .