带有选择和清除图标的Bootstrap搜索框

时间:2014-12-22 07:36:35

标签: html css twitter-bootstrap

我想在bootstrap 3+中选择选项和清除按钮的大搜索框。我尝试了下面的代码,但它没有正确对齐。

<form role="form">
   <div class="row">
      <div class="input-group">
         <span class="input-group-addon glyphicon glyphicon-search"></span>
         <select class="input-group-addon selectpicker">
            <option>Mustard</option>
            <option>Ketchup</option>
            <option>Relish</option>
         </select>
         <input Placeholder="Search Food" type="text" class="form-control input-lg hasclear">
         <span class="clearer input-group-addon glyphicon glyphicon-remove-circle"></span>
      </div>
   </div>
</form>

演示:http://dietbook.xyz/

1 个答案:

答案 0 :(得分:1)

这是你想要的吗?

<div class="row">
  <div class="col-lg-6">
    <div class="input-group">
      <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" 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 -->
      <input type="text" class="form-control"> <span class="input-group-addon glyphicon glyphicon-search"></span>
    </div><!-- /input-group -->
  </div><!-- /.col-lg-6 -->