views:

402

answers:

1

I want to define a CSS class that will provide the same style as HTML's <pre> element. I tried this:

.mystyle 
{ 
   display: block;
   font-family: monospace;
   white-space: pre;
}

which works fine on FF but not on IE (white-spaces are not kept). Does anyone have a clue?

+6  A: 

white-space:pre is supported only by IE6 and newer.

Your page probably doesn't have DOCTYPE or has and outdated one, which enables emulation of IE5 in all newer versions of IE.

Add HTML4 Strict DOCTYPE to your document. Make sure there isn't anything else before DOCTYPE, because IE6 won't "see" it.

porneL