简体   繁体   中英

message is not displayed on a new line

I am trying to display the message when I make a comment and it is not displaying all the new lines.

so I have a text area

<textarea style="font-family: Arial; font-size: 10px; border: 1px solid ##dddddd; padding: 2px;"></textarea>

and when I make a comment with it , its shows the way its supposed to

text 1 
text 2

this is the output of the message

<div style="padding-top: 2px; padding-left: 10px; height:50px;">
    <font class="text_medium">
    <font color="##555555">
        #message#
    </font>
    </font>
</div>

but when I approve the comment the text shows

text 1 text 2

how do I make my #message# show these new lines that were showing from text area ? thanks in advance

To give you a ColdFusion specific answer (rather than just CSS) try this:

<div style="padding-top: 2px; padding-left: 10px; height:50px;">
    <font class="text_medium">
    <font color="##555555">
        #paragraphformat(message)#
    </font>
    </font>
</div>

That automatically replaces carraige returns with BR tags.

-mark

Try using pre tag

<div class="text_medium">
    <pre style="color:#555555">
        #message#
    </pre>
</div>

Also suggesting you don't use font as font is HTML5 Deprecated Tag

It's because you're passing as plain text. There are a few things you can do

<pre>#message#</pre>

Or you can use a regex to replace

#REReplace(Message, "\r\n|\n\r|\n|\r", "<br />", "all")#

source: How to replace CR+LF with <br />?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM