【问题标题】:Can't position Bootstrap date picker in the right position无法将 Bootstrap 日期选择器定位在正确的位置
【发布时间】:2015-05-24 17:33:38
【问题描述】:

我有以下 HTML,我想将日期选择器放置在数量选择和提交按钮之间。它仅显示在页面中按钮之后。

<div class="container">
       <form class="form-inline" role="form">

    <!-- *** This should show-up first *** -->
       <div class="form-group col-sm-2">
           <label label-default="label-default" for="Qty">Qty</label>
           <span class="addon glyphicon glyphicon-user"></span>
           <select class="form-control input-sm" id="Qty">
                        <option>1</option>
                        <option>2</option>
                        <option>3</option>
                        <option>4</option>
           </select>
        </div>

  <!-- ** The Datepicker should sow up after, in the middle ***-->
        <div class="input-daterange input-group col-sm-2" id="DatePickerId">
         <input type="text" class="input-sm form-control" data-provide="datepicker" buttonClasses="glyphicon glyphicon-calendar" name="start" placeholder="Start" id="startdate"/>
           <span class="input-group-addon">
             <label for="startdate" class="glyphicon glyphicon-calendar"></label>
           </span>
           <input type="text" class="input-sm form-control" data-provide="datepicker" buttonClasses="glyphicon glyphicon-calendar" name="end" placeholder="End" id="enddate"/>
           <span class="input-group-addon">
            <label for="enddate" class="glyphicon glyphicon-calendar"></label>
           </span>
        </div>

   <!-- *** The button should show up in third *** -->

        <div class="form-group col-sm-3">
          <button class="form-control input-sm btn btn-default" id="SubmitId" data-modal-template="Submit">Submit</button>
         </div>
        </form>

但它是这样显示的:

如何让它以正确的顺序显示?

【问题讨论】:

  • 代码看起来一切正常,这可能是您的 css 中的问题。您可以将链接发布到您的页面或我们可以看到 css 代码的地方吗?

标签: twitter-bootstrap datepicker bootstrap-datepicker


【解决方案1】:

使用这个放置日历并在单独的 div 中提交

<div class="container">
<form class="form-inline" role="form">

   <div class="form-group col-sm-2">
      <label label-default="label-default" for="Qty">Qty</label>
      <span class="addon glyphicon glyphicon-user"></span>
      <select class="form-control input-sm" id="Qty">
         <option>1</option>
         <option>2</option>
         <option>3</option>
         <option>4</option>
      </select>
   </div>
   <div class="col-xs-2 ">

      <div class="input-daterange input-group col-sm-2" id="DatePickerId">
         <input type="text" class="input-sm form-control" data-provide="datepicker" buttonClasses="glyphicon glyphicon-calendar" name="start" placeholder="Start" id="startdate"/>
         <span class="input-group-addon">
         <label for="startdate" class="glyphicon glyphicon-calendar"></label>
         </span>
         <input type="text" class="input-sm form-control" data-provide="datepicker" buttonClasses="glyphicon glyphicon-calendar" name="end" placeholder="End" id="enddate"/>
         <span class="input-group-addon">
         <label for="enddate" class="glyphicon glyphicon-calendar"></label>
         </span>
      </div>
   </div>
   <div class="col-xs-2 ">
      <!-- *** The button should show up in third *** -->
      <div class="form-group col-sm-3">
         <button class="form-control input-sm btn btn-default" id="SubmitId" data-modal-template="Submit">Submit</button>
      </div>
   </div>
</form>

【讨论】:

  • 非常感谢!这解决了这个问题。作为一个额外的发现。我还从下面的第二个
    - 控制,我将其更改为 col-sm-3。再次感谢!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-10-16
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-05-14
  • 2019-06-30
相关资源
最近更新 更多