Welcome to WebmasterWorld Guest from

Forum Moderators: incrediBILL

Message Too Old, No Replies

Wrapping <pre> text naturally

I want the carriage returns... but not the nowrap bahaviour



12:06 pm on Jun 11, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

Hi all,

How's it going?

I need to use the pre tag or an equivalent to get display some text and maintain the line breaks... but the text must also wrap naturally when it hits a specified boundary (width) example:

<pre style="width:100px">
The following carriage return is displayed..

But this line will force the display much wider then intended because it is so looong...

I'm sure you get the picture. Because we are using XSL call-templates (that use a copy-of) to display the code we cannot just replace a CR with a <br/> - it just can't happen that way unfortunately...

so we need to find a way to deal with it in HTML/CSS and I'm sure one of you guys will have the answer (this needs only work for me in IE5+ BTW)

Thanks in advance y'all


12:11 pm on Jun 11, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

Sometimes, just visiting WebmasterWorld is enough to set me off in the right direction!

A textarea does almost what I need but for the scrollbars... bingo!

<textarea style="overflow:visible" readonly="readonly">

If anyone has a better (less hacky solution) I'd love to hear it.




Featured Threads

Hot Threads This Week

Hot Threads This Month