Display carriage return and space in HTML

Source: Internet
Author: User

recently, I was busy switching a C/S system to B/S. The text editing is changed to the fck Editor, which leads to incorrect display format of old data in the database.
solution: retrieve the data STR first, and then use Str. replaceall ( " " , " & nbsp; " ). replaceall ( "\ r \ n ", "
" );
Note: The removed space is blank "", and the HTML space is & nbsp; this method can also replace tabs.

a solution on the Internet is to use the

 label. W3C defines the pre element as follows: pre elements can define pre-formatted text. Text enclosed in the PRE element usually contains spaces and line breaks. The text is also displayed as an equal-width font. For more details, refer. This includes the information you entered on the  Code  page. Therefore, if you use the pre element, you need to write:    pre  >  text to be output     pre  >, instead of the following: 
pre >
text to be output
pre > the white space before the text is displayed. Unless you really want it to be like this
but I tried it, it converts the data into a long line.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.