If you're using PHP/mySQL then you could always write a simple function like below, or use PHP's built-in nl2br() function.
//Clean-up function to remove BRs and whitespace from data wihtout hurting the HTML function nl2br_skip_html($string) { // remove any carriage returns (mysql) $string = str_replace("\r", '', $string); // replace any newlines that aren't preceded by a > with a <br /> $string = preg_replace('/(?<!>)\n/', "<br />\n", $string); return $string; } -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Andreas Boehmer [Addictive Media] Sent: Tuesday, 25 October 2005 1:59 PM To: wsg@webstandardsgroup.org Subject: RE: [WSG] specifying width of <pre> Other than a scroll bar (overflow) there is no solution? The reason I need to use <pre> is that the content comes from a database that doesn't use HTML <br>'s, but normal linebreaks. So to format the text correctly I need to put it in <pre> tags, but of course I want it to still fit into the rest of the content. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Joshua Street Sent: Monday, 24 October 2005 6:32 PM To: wsg@webstandardsgroup.org Subject: Re: [WSG] specifying width of <pre> <code><pre>content</pre></code> Gives you an alternate parent element which you can then set to scroll or whatever, preventing the content from spilling out across your layout generally. I think. On 10/24/05, Andreas Boehmer [Addictive Media] <[EMAIL PROTECTED]> wrote: > > Is there any way to specify a max width for content of <pre> tags? > Currently the content of my <pre> tags does not automatically wrap > when the parent div is at an end - it just keeps on running until it finds > the end of the line. > I know the idea of the <pre> tag is to display the content as it is, > but of course I want it to remain in the boundaries of my parent element. > > Any ideas? -- Joshua Street http://www.joahua.com/ +61 (0) 425 808 469 Nnvy jq♞z ****************************************************** The discussion list for http://webstandardsgroup.org/ See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list & getting help ****************************************************** ****************************************************** The discussion list for http://webstandardsgroup.org/ See http://webstandardsgroup.org/mail/guidelines.cfm for some hints on posting to the list & getting help ******************************************************