How to do a wordwrap within a pre?

0

I have a <pre>Oie</pre> tag

I wanted this text to be at maximum width of 595px word-wrap:break-word; What I did was the following

pre {
width:595px;
word-wrap:break-word;

}

I do this, but nothing happens, I just squeeze it up

<pre>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</pre>

and the text does not break

    
asked by anonymous 23.11.2017 / 19:11

1 answer

0

Use the style white-space , in addition to word-wrap: break-word; , to apply line break for long strings within <pre> :

pre {
   width:595px;
   white-space: pre-wrap;
   word-wrap: break-word;   
}
<pre>aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</pre>
    
23.11.2017 / 19:18