多行html textarea(multiline html textarea)

我的表单继承了几种css样式,而textarea的默认显示只有一行 - 如果你键入一个段落,它将不会换行但继续走同一行。 我如何强制它回到多行输出? 我在HTML中设置了“rows”和“cols”属性,但它似乎没有做任何事情。

HTML是高度嵌套的,但实际的输入元素是:

<input name="input47" type="textarea" rows="3" cols="10" />

我试过的CSS是:

body form ol.sections li ol.prompts li ol.entries li ol.inputs li input[type=textarea] { height: 500px !important; white-space: normal !important; }

500px的作品不管我是否使用!important ,但textarea中只有一行文本,垂直居中(Chrome和Safari)。

编辑:显然我需要刷上我的HTML-- <input type="textarea">应该是<textarea>

My form inherits several css styles, and the default display for a textarea only has a single row-- if you type a paragraph it won't wrap but continues going one the same line. How do I force it back to multi-row output? I have set the "rows" and "cols" attributes in the HTML but it doesn't seem to do anything.

The HTML is highly nested, but the actual input element is:

<input name="input47" type="textarea" rows="3" cols="10" />

The CSS I've tried is:

body form ol.sections li ol.prompts li ol.entries li ol.inputs li input[type=textarea] { height: 500px !important; white-space: normal !important; }

The 500px works regardless whether or not I use !important, but there is only a single line of text in the textarea, vertically centered (Chrome and Safari).

EDIT: Clearly I need to brush up on my HTML-- <input type="textarea"> should have been <textarea>

最满意答案

@ macaroon5,你在这里误用<input />元素。 你想得到的是

<textarea name="input47" rows="3" cols="10"> Your multiline text is here. </textarea>

这里是例子

@macaroon5, you misuse <input /> element here. What you want to get is

<textarea name="input47" rows="3" cols="10"> Your multiline text is here. </textarea>

Here is the example

更多推荐