Bootstrap表单下拉按钮

时间:2015-04-23 21:06:00

标签: twitter-bootstrap

如何使用Bootstrap 3从选择表单创建一个下拉按钮。

<div class="input-group">
  <form>
    <input type="text"  name="search" class="form-control">
    <span class="input-group-btn">
    <select class="form-control" name="my_list">
      <option value="one">One</option>
      <option value="two">Two</option>
      <option value="three">Three</option>
    </select>
    <button type="submit" class="btn btn-default"> GO</button>
    </span>
  </form>
</div>![ See image below for intended look][2]

enter image description here

1 个答案:

答案 0 :(得分:4)

以下是http://getbootstrap.com/components/#input-groups-buttons-dropdowns

的示例
  <div class="input-group">
  <input type="text" class="form-control" aria-label="...">
  <div class="input-group-btn">
    <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false">Action <span class="caret"></span></button>
    <ul class="dropdown-menu dropdown-menu-right" role="menu">
      <li><a href="#">Action</a></li>
      <li><a href="#">Another action</a></li>
      <li><a href="#">Something else here</a></li>
      <li class="divider"></li>
      <li><a href="#">Separated link</a></li>
    </ul>
  </div><!-- /btn-group -->
</div><!-- /input-group -->