This is a bug in the Google Chrome browser (I'm running 14.0.803.0 dev), where code blocks wrap text, and it is very annoying:

annoying text wrap

Fortunately, I have a fix for you! Just add this to your CSS:

pre {
  word-wrap: normal;
  • 1
    Eh, if that horizontal scrollbar shows in your code blocks you're doing something wrong. – user1228 Jun 28 '11 at 14:33
  • 2
    @Won't, it seems half the ios questions with code in them are 100+ characters wide. NSIGuessThatIsTheDownside: OfReallyLongParameterizedArguments. – sarnold Jun 29 '11 at 2:53
  • @sarnold: dunno how they handle line breaks in that language. Most languages allow continuation on the next line via some token (newline, underscore, etc).... – user1228 Jun 29 '11 at 13:29
  • @Won't, it's true that it could be written that way; but after a level or two of indentation, it's hard to fit both the name and parameter on the same line and still fit in 80 columns. I don't know how they read their code without going crazy. :) – sarnold Jun 29 '11 at 20:26

This fix didn't have quite the expected effects. Backed out for now; overflowing links aren't half as bad (as they are a rare edge case, unlike codeblocks with horizontal scrollbars).

  • Can't you just add word-wrap: break-word; only on <a>s? – Felix Jun 28 '11 at 13:04
  • @Felix: That issue has nothing to do with links. – balpha Jun 28 '11 at 13:34
  • It seems to be back again... Chrome 32.0.1700.107 m. – TLama Feb 21 '14 at 16:17
  • 1
    @TLama Argh, my fault, side effect of this; will fix. Thanks for the heads-up. – balpha Feb 21 '14 at 16:31
  • @TLama Should be fixed in 3m48s. – balpha Feb 21 '14 at 16:48
  • @balpha, thanks! Will try tomorrow... – TLama Feb 21 '14 at 18:18

I can repro this on Mac OS X 10.6.6 and Chrome 12. Interestingly enough when you go to edit a question it works.

  • Yup, noticed that, too. It's probably because the preview is generated from JavaScript and not loaded in-page. – Felix Jun 28 '11 at 12:46

I can reproduce this on Chrome 12.0.742.100 (Windows 7).

You must log in to answer this question.

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