Bootstrap输入组中的Segment按钮下拉列表

要在输入组中细分按钮下拉菜单,请使用与下拉按钮相同的常规样式,但要在下拉菜单中添加主要操作,如以下示例所示:

示例

<!DOCTYPE html>
<html>
   <head>
      <title>Bootstrap Example</title>
      <link href = "/bootstrap/css/bootstrap.min.css" rel = "stylesheet">
      <script src = "/scripts/jquery.min.js"></script>
      <script src = "/bootstrap/js/bootstrap.min.js"></script>
   </head>
   <body>
      <div style = "padding: 100px 100px 10px; background: red;">
         <form class = "bs-example bs-example-form" role = "form">
            <div class = "row">
               <div class = "col-lg-6">
                  <div class = "input-group">
                     <div class = "input-group-btn">
                        <button type = "button" class = "btn btn-default" tabindex = "-1">Subject</button>
                           <button type = "button" class = "btn btn-default dropdown-toggle"
                              data-toggle = "dropdown" tabindex = "-1">
                              <span class = "caret"></span>
                              <span class = "sr-only">Toggle Dropdown</span>
                           </button>
                           <ul class = "dropdown-menu">
                              <li><a href = "#">Maths</a></li>
                              <li><a href ="#">Science</a></li>
                           </ul>
                        </div><!-- /btn-group -->
                     <input type = "text" class = "form-control">
                  </div><!-- /input-group -->
               </div><!-- /.col-lg-6 -->
               <br>
             
               <div class = "col-lg-6">
                  <div class = "input-group">
                     <input type = "text" class = "form-control">
                     <div class = "input-group-btn">
                        <button type = "button" class = "btn btn-default" tabindex = "-1">
                           Course
                        </button>
                        <button type = "button" class = "btn btn-default dropdown-toggle"
                           data-toggle = "dropdown" tabindex = "-1">
                           <span class = "caret"></span>
                           <span class = "sr-only">Toggle Dropdown</span>
                        </button>
                        <ul class = "dropdown-menu pull-right">
                           <li><a href = "#">BCA</a></li>
                           <li><a href = "#">MCA</a></li>
                        </ul>
                    </div><!-- /btn-group -->
                  </div><!-- /input-group -->
               </div><!-- /.col-lg-6 -->
            </div><!-- /.row -->
         </form>
      </div>
   </body>
</html>