浏览器是否删除任何html标签文本之间的空格 [英] Do browsers remove whitespace in between text of any html tag
本文介绍了浏览器是否删除任何html标签文本之间的空格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是演示问题的小提琴
我在标签标签的内容中插入了许多空格,但呈现的html似乎将其删除。仅为& nbsp;
添加上述问题的解决方案
$ b HTML内容
< label>标签的中间有非常长的空格< / label>
解决方案
显示空格的正常行为是压缩他们成为一个单一的,然后显示。
有两个例外:
-
< pre> ;
标记,它保持输入的空白。 - 设置CSS属性
white-space:pre;
(分别为pre-wrap
或pre-line
)
Here is a fiddle demonstrating the problem
I have inserted many whitespace in the content of the label tag but the html rendered seems to remove it. Is adding
only solution to the above problem
HTML Content
<label>label with very long white space in between</label>
解决方案
The normal behavior for the display of whitespaces is to compress them into a single one, which is then displayed.
There are two exceptions from that:
- The
<pre>
tag, which keeps the whitespaces as entered. - Setting the CSS property
white-space: pre;
(respectivelypre-wrap
orpre-line
)
这篇关于浏览器是否删除任何html标签文本之间的空格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文