使表单高度更大,并使文本适合框内

时间:2017-03-15 10:52:05

标签: html

我可以增加表单的高度以进行提问,但是文本不包含在框中。打字不断向下到下一行留在盒子里。

在css中使用的高度设置为150px。

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>


<form>
  <div class="form-group">
    <label for="exampleInputEmail1">Email address</label>
    <input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="Enter email">
  </div>
</form>
<form>
  <div class="form-group enter-question">
    <label for="exampleInputEmail1">Enter your question: </label>
    <input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="Enter email">
  </div>
</form>

1 个答案:

答案 0 :(得分:1)

听起来你想要使用textarea:

<form>
  <div class="form-group">
    <label for="exampleInputEmail1">Email address</label>
    <textarea type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="Enter email"></textarea>
  </div>
</form>
<form>
  <div class="form-group enter-question">
    <label for="exampleInputEmail1">Enter your question: </label>
    <input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="Enter email">
  </div>
</form>

请参阅此jsfiddle:https://jsfiddle.net/z66oo7hw/

Textarea将允许用户在多行上书写,然后您可以自己指定它的高度。