How do I wrap text in a pre tag for Internet explorer?

1k Views Asked by At

I am using following code to wrap the <PRE> region in HTML:

 <PRE style = "white-space: pre-wrap;
               white-space: -moz-pre-wrap;
               white-space: -pre-wrap;
               white-space: -o-pre-wrap;
               word-wrap: break-word;">

It is working fine on chrome and Mozilla but the same is not working for IE. I am using IE9.

Please tell me if any other property needs to be set to wrap the text in IE?

1

There are 1 best solutions below

3
On BEST ANSWER

For IE 6 and 7 you need to wrap your text with a tag and give it a white-space property. Since you already have a tag wrapped around your text and you have a class for it, just add the white-space property to your do something like this

#pre-wrap {
  white-space: pre-wrap;
}
    <p id="pre-wrap">
    Lorem ipsum dolor sit amet
       consectetuer    adipiscing   elit     sed   diam   nonummy   
    
    
    nibh euismod tincidunt ut laoreet
    </p>