使输入元素(type=“text")处理多行文本 [英] Make input element (type="text") handle multiple lines of text

查看:30
本文介绍了使输入元素(type=“text")处理多行文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个带有输入的表单,但该框仅处理单行中的文本.我想设置它的样式,以便输入字段类似于 Twitter 的输入字段,其中框本身是多行:

I've created a form with an input, but the box only handles text in a single row. I would like to style it so that the input field is similar to that of Twitter's, where the box itself is multiple rows:

当你按下回车键时它也会展开:

And it also expands when you hit enter:

这是我目前拥有的:

<form name="userForm">
  <input type="text" id="userInput" name="userInput" placeholder="Enter text here.">
  <button type="submit" id="button">Submit</button>
</form>

我已经为按钮和输入设置了样式,但没有做任何改变它的形状的事情,所以它是默认的.我需要调整什么才能实现这一目标?

I've styled the button and the input, but haven't done anything to change its shape, so it's at default. What do I have to tweak to achieve this?

推荐答案

您需要使用 HTML