I’ve been staring at this for quite a while and I’m sure it’s something obvious, but I need another set of eyes.
I’m using Google Prettify to syntax highlight code blocks on my Tumblr blog. Everything is working great except I don’t want the code to wrap unless it is truly an EOL. Instead, a scrollbar should appear when the text is too wide for the containing block.
Here’s an example: http://accidentalhacker.com/post/15521210350/sticky-notes-with-css3
If I inspect the <pre> element in Chrome, overflow is properly set to auto and white-space is set to pre, so I have no idea why the text is still wrapping.
The wrapping is caused by the
word-wrap: break-wordsetting on the enclosingdivelement. For some reason, Chrome does not show this property as inherited when you inspect thepreelement, but it still affects the rendering.If the setting is needed for the
divfor some reason, override it by settingword-wrap: normalfor thepreelement.