如何摆脱文本区域中的多余空间? [英] How to get rid of extra spaces in a textarea?
本文介绍了如何摆脱文本区域中的多余空间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在生成一个HTML表单,该表单在文本区域中包含一些代码.
I am generating an HTML form, which contains some code in a text area.
生成的HTML如下所示:
The generated HTML looks like this:
<textarea id="message" name="message"
rows="18" cols="40">The quick brown fox
<?php echo $page_url;?>
</textarea>
在浏览器中呈现页面时,它看起来像这样:
When the page is rendered in a browser, it looks like this:
The quick brown fox
http://www.example.com
我无法解释它,因为该变量不包含任何前导空格-也不应用CSS样式.
I cant explain it, since the variable contains no leading spaces - and no CSS styling is being applied either.
有人能想到这是什么原因吗?
can anyone think of what may be causing this?
推荐答案
< textarea>
内的空格按原样呈现,而不像HTML那样将连续的空格呈现为一个.
Whitespaces inside <textarea>
are rendered as-is, unlike HTML, which renders successive whitespace as one.
<textarea id="message" name="message"
rows="18" cols="40">The quick brown fox<?php echo $page_url;?></textarea>
这篇关于如何摆脱文本区域中的多余空间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文