【问题标题】:Bootstrap 3.1 form-horizontal button group problemBootstrap 3.1 表单-水平按钮组问题
【发布时间】:2019-03-14 23:48:12
【问题描述】:

我在引导程序 3.1 中使用水平形式,其中标签直接位于输入上方。我正在尝试使用附加按钮进行输入,但由于标签增加了行高,因此对齐已关闭。有谁知道如何修理它? Bootply

<form name="ReservationForm" class="form-horizontal">
  <div class="form-group form-group-sm">                                                                                    
     <!-- Reservation Date -->                                      
     <div class="col-sm-2">
       <label class="control-label required" for="reservationDate"><span class="sr-only">Required</span>Appointment Date</label>
       <input name="reservationDate" class="form-control  dateField hasDatepicker" id="reservationDate" type="text" size="25" readonly="readonly" value="">                                 
     </div>
     <div class="col-sm-3">                                                                                         
       <div class="input-group">
         <label class="control-label" for="reservationStartTime">Appointment Time </label>
         <input class="form-control" id="reservationStartTime" type="text" readonly="true" value="No time slots displayed">                                                                 
         <div class="input-group-btn">
           <input name="actionType" class="btn btn-primary btn-sm" id="actionType" type="submit" value="Search Time Slots">                                                                                                 
         </div>
       </div>
    </div>  
  </div>
</form> 

【问题讨论】:

    标签: twitter-bootstrap twitter-bootstrap-3


    【解决方案1】:

    是的,.control-label 破坏了.input-group,因为&lt;label&gt;必须在输入组之外;只需将其移到外面或“上一层”:

    <div class="col-sm-3">                                           
      <!-- label moved outside input-group -->                                              
      <label class="control-label" for="reservationStartTime">Appointment Time </label>
    
      <div class="input-group">
         <input class="form-control" id="reservationStartTime" type="text" readonly="true" value="No time slots displayed">                                                                 
         <div class="input-group-btn">
            <input name="actionType" class="btn btn-primary btn-sm" id="actionType" type="submit" value="Search Time Slots">                                                                                                 
         </div>
      </div>
    </div> 
    

    这会起作用的。

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-03-17
    • 2020-10-22
    • 2012-09-10
    • 1970-01-01
    • 2023-03-03
    • 2011-05-09
    相关资源
    最近更新 更多