textarea元素中的换行符 [英] Line breaks in textarea element

查看:268
本文介绍了textarea元素中的换行符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是PURE HTML。 (没有php或任何类似的,如果你想知道它的一个C#应用程序与HTML在web视图的背景)。



所有我的HTML文件格式正确,

 > < tr> 
< td class =label>诊所时间:< / td>
< td>< textarea name =familyPlanningClinicSessionsClinicTimes>星期一:
星期二:
星期三:
星期四:
星期五:
星期六:
星期日:< / textarea>< / td>
< / tr>

< textarea>< / textarea& code>元素在页面上获取换行符。





< /i.stack.imgur.com/tI0aM.pngalt =example>



我认为删除此问题的唯一方法是删除缩进。它不是世界的尽头,但还有另一种方式,保持好的格式化?感谢。

解决方案

您可以使用&#10; 它表示html中的新行),但也许这不是一个好的格式,像你说...


我可以想到的唯一方法删除这个问题是删除缩进。




 < tr> 
< td class =label>诊所时间:< / td>
< td>< textarea name =familyPlanningClinicSessionsClinicTimes>星期一:&#10;星期二:&#10;星期三:&#10;星期四:&#10;星期五: #10;星期六:&#10;星期日:< / textarea>< / td>
< / tr>


This is PURE HTML. (no php or anything like that, if you want to know the background its a C# application with HTML in a webview).

All my HTML files are nicely formatted and correctly indented for maintainability and such.

Here is an excerpt:

                            <tr>
                                <td class="label">Clinic Times:</td>
                                <td><textarea name="familyPlanningClinicSessionsClinicTimes">Monday:
                                Tuesday:
                                Wednesday:
                                Thursday:
                                Friday:
                                Saturday:
                                Sunday:</textarea></td>
                            </tr>

The linebreaks in the <textarea></textarea> element are there to get the line breaks on the page. However it also includes the indentation in the textarea element.

e.g.

The only way I can think to remove this issue is to remove the indentation. Its not the end of the world, but is there another way, to keep the nice formatting? Thanks.

解决方案

You could use the &#10; (it means new line in html) but maybe that's not a nice formatting, like you said...

The only way I can think to remove this issue is to remove the indentation. Its not the end of the world, but is there another way, to keep the nice formatting?

<tr>
  <td class="label">Clinic Times:</td>
  <td><textarea name="familyPlanningClinicSessionsClinicTimes">Monday:&#10;Tuesday:&#10;Wednesday:&#10;Thursday:&#10;Friday:&#10;Saturday:&#10;Sunday:</textarea></td>
</tr>

这篇关于textarea元素中的换行符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆