Can someone please tell me the CSS to get text to wrap when inside PRE tags. I've already triedpre {
word-wrap: break-word;
}andpre {
word-wrap: normal;
}But neither seem to work!There is this concept that you read before you write...:
<!-- m --><a class="postlink" href="http://www.w3.org/TR/CSS21/text.html#propdef-white-spaceThe">http://www.w3.org/TR/CSS21/text.html#pr ... e-spaceThe</a><!-- m --> whole point of <pre> (<!-- m --><a class="postlink" href="http://www.w3.org/TR/REC-html40/struct/text.html#h-9.3.4">http://www.w3.org/TR/REC-html40/struct/ ... ml#h-9.3.4</a><!-- m -->) is to prevent this happening.
The property value you are looking for is white-space : normal;OK then. I was yoing to use <PRE> to maintain whitespace in text pulled from a DB, but I gues I'll just use some preg_match()-ing to swap ' ' for & nbsp;.Well, if this is PHP powered, why not just identify the text within the pre element and apply wordwrap (<!-- m --><a class="postlink" href="http://us3.php.net/manual/en/function.wordwrap.php">http://us3.php.net/manual/en/function.wordwrap.php</a><!-- m -->) to it?
word-wrap: break-word;
}andpre {
word-wrap: normal;
}But neither seem to work!There is this concept that you read before you write...:
<!-- m --><a class="postlink" href="http://www.w3.org/TR/CSS21/text.html#propdef-white-spaceThe">http://www.w3.org/TR/CSS21/text.html#pr ... e-spaceThe</a><!-- m --> whole point of <pre> (<!-- m --><a class="postlink" href="http://www.w3.org/TR/REC-html40/struct/text.html#h-9.3.4">http://www.w3.org/TR/REC-html40/struct/ ... ml#h-9.3.4</a><!-- m -->) is to prevent this happening.
The property value you are looking for is white-space : normal;OK then. I was yoing to use <PRE> to maintain whitespace in text pulled from a DB, but I gues I'll just use some preg_match()-ing to swap ' ' for & nbsp;.Well, if this is PHP powered, why not just identify the text within the pre element and apply wordwrap (<!-- m --><a class="postlink" href="http://us3.php.net/manual/en/function.wordwrap.php">http://us3.php.net/manual/en/function.wordwrap.php</a><!-- m -->) to it?