在页面中呈现的HTML看起来不错,但实际结果是否定的 [英] HTML rendered in the page looks ok, but the actual result is no
问题描述
我正在开发一个页面,我从服务器(sharepoint)返回数据,并使用$(#Fees).html()在段落元素中显示它。
文本应该包含回车符,当我在呈现的html内部查看它时,它显示ok,如下所示:
< p id =费用>费用应该如下:
主要费用:
1-费用1
2- Fee2< / p>
正如您所看到的,在我的段落中,回车符是可见的,但是在我的页面上,它不是,如下所示:
费用应该包括以下内容:主要费用:1-费用1 2-费用2
我该怎么办?它是与代码相关的东西,还是与段落标签已知的东西?我用div标签试过,结果相同。任何想法都会很棒。
添加以下CSS
#Fees {
white-space:pre
}
将会使< p>
标签的行为类似于pre标签,而不会发生所有其他更改< pre>
标签(例如字体)
I am developing a page, I am returning data from the server (sharepoint), and displaying it in a paragraph element using $("#Fees").html();
The text should contain carriage return, it shows ok when I view it inside the rendered html itself like the following:
<p id="Fees">Fees should be like the following:
Main fees:
1- Fee1
2- Fee2</p>
As you can see, inside my paragraph, the carriage return is visible, however, on my page, it's not, as you can see below:
Fees should be lik the following: Main fees: 1- Fee1 2- Fee2
What should I do? Is it something related to code, or is it a known thing with paragraph tags? I tried it with div tag, and same result. Any idea would be great.
add the following CSS
#Fees {
white-space: pre
}
This will make that <p>
tag behave like a pre tag, without all the other changes a <pre>
tag has (like font for instance)
这篇关于在页面中呈现的HTML看起来不错,但实际结果是否定的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!