pre-wrap
This value behaves as the pre value, except that it adds extra line
breaks to prevent the text breaking out of the element's box. (Quirksmode)
From this mozilla post (click the 'mobile' tab) and the fact that the white-space
property is tagged there as 'NeedsMobileBrowserCompatibility' (see here ), it seems like white-space is not supported on mobile as yet.
Workaround #1
The word-wrap
property is supported in mobile (see here)
So you could produce the same very similar results wrapping the markup in <pre>
tags and adding
word-wrap: break-word;
to the class. (see this css-tricks post)
Something like this:
Markup
<pre>his is the test paragraph.
It has all kinds of odd tabs and spacing in
the
HTML source code.
Should they be preserved?</pre>
CSS
pre
{
width: 100px;
border: 1px solid orange;
word-wrap: break-word;
}
FIDDLE
Workaround #2
Wrap the text in a readonly textarea
element. The obvious issue with this is that you'll have to know the width/height of your text in advance. (see this SO post)
FIDDLE