将HTML输入按钮的文本值包装在多行上 [英] Wrapping an HTML input button's text value over multiple lines

查看:51
本文介绍了将HTML输入按钮的文本值包装在多行上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用 type ="button" 属性将文本移动到HTML输入元素中的新行?

How do I move text to a new line in an HTML input element with the type="button" attribute?

我有以下代码:

<input type="button" id="btnTexWrapped" value="I see this is a long sentence here." style="width: 200px;" />

我希望按钮的文本值用两行换行.我尝试将其键入HTML的下一行.它没有按我预期的那样工作:

I want the button's text value to be wrapped in two lines. I tried typing it into the next line in HTML. It didn't work as I expected:

<input type="button" id="btnTexWrapped" value="I see this is a long 
sentence here." style="width: 200px;" />

我还尝试使用固定宽度 width:200px; 的所有 white-space 选项,但是仍然没有任何效果.

I also tried using all options of white-space with fixed width: 200px;, but still nothing works.

我可以固定长度,宽度或其他值,因为控件不会更改.

I am OK with statically fixing the length, width, or other values: as the control is not going to change.

推荐答案

尝试一下,您可以立即看到它的工作原理:

Try this, you can see how it works instantly:

<input type="button" value="Carriage&#13;&#10;return&#13;&#10;separators" style="text-align:center;">

这篇关于将HTML输入按钮的文本值包装在多行上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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