Bootstrap文本输入无法正确呈现

时间:2015-09-07 15:51:41

标签: html twitter-bootstrap

我的一个文本字段输入无法正确呈现。我正在使用bootstrap。这就是它的样子。

enter image description here

这是我正在使用的代码。

<div class="modal-body">

  <form class="form-inline">
    <div class="form-group">
      <label for="input1">First Name</label>
      <input type="text" class="form-control" id="input1" placeholder="First Name">
    </div>
    <div class="form-group">
      <label for="input2">Last Name</label>
      <input type="text2" class="form-control" id="input2" placeholder="Last Name">
    </div>
    <button type="submit" class="btn btn-default">Send invitation</button>
  </form>

</div>

我注意到,当输入type正好是text时,输入字段无法正确呈现,但当type为其他内容时,输入字段就可以了。我究竟做错了什么?

2 个答案:

答案 0 :(得分:1)

看起来,这只是一个猜测而不能看到你所有的代码,你有一些匹配input[type="text"]的风格,这就是给你奇怪的结果。

引导程序没有问题,相反,它可能是你的最终目的。

答案 1 :(得分:1)

工作正常,这意味着您可能有旧的Bootstrap,或者某些样式覆盖默认input[text]并注意,bootstrap并不关心type="text2"作为 by默认是文本类型

&#13;
&#13;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"/>

<div class="modal-body">

  <form class="form-inline">
    <div class="form-group">
      <label for="input1">First Name</label>
      <input type="text" class="form-control" id="input1" placeholder="First Name">
    </div>
    <div class="form-group">
      <label for="input2">Last Name</label>
      <input type="text2" class="form-control" id="input2" placeholder="Last Name">
    </div>
    <button type="submit" class="btn btn-default">Send invitation</button>
  </form>

</div>
&#13;
&#13;
&#13;