9

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;
}
4
  • 1
    Eh, if that horizontal scrollbar shows in your code blocks you're doing something wrong.
    – user1228
    Commented Jun 28, 2011 at 14:33
  • 2
    @Won't, it seems half the ios questions with code in them are 100+ characters wide. NSIGuessThatIsTheDownside: OfReallyLongParameterizedArguments.
    – sarnold
    Commented Jun 29, 2011 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
    Commented Jun 29, 2011 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
    Commented Jun 29, 2011 at 20:26

3 Answers 3

7

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).

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

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.

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

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 .