How to preserve line breaks in <code> block?

css

Solution

Check your doctype is valid and on the first line. Maybe it's slipping into quirks mode?

Problem

I have some code samples which I want to publish in an HTML document. I'm wrapping them with `<code>`, tags but I'd like them to be styled such that line breaks are preserved. I can do this by also enclosing them with `<pre>` tags, but I'd prefer to use CSS. I've tried the following in IE7 (which according to this reference should work), but with no joy (line breaks are stripped): ``` code { white-space: pre; } ``` Is this possible?

Original source