向右浮动元素

时间:2016-04-26 16:31:36

标签: html css twitter-bootstrap twitter-bootstrap-3

代码

<div class="input-group">
  <div class="input-group-addon">
    <i class="fa fa-search"></i>
  </div>
  <input type="text" class="form-control" id="txtPreCurrentdate" data-provide="datepicker" placeholder="Enter a Start Date">
  <span class="input-group-addon">-</span>
  <input type="text" class="form-control" id="txtPostCurrentdate" data-provide="datepicker" placeholder="Enter an End Date">


  <!-- want the below section to move to the right. -->
  <div class="input-group-addon">
    <i class="fa fa-server"></i>
  </div>
  <input type="number" id="txtResltsPerPage" class="form-control" ng-model="pageSize" placeholder="Results per Page 10">
</div>

enter image description here 使用上面的代码,所有元素彼此相邻,如上图所示。我需要上面代码中的最后<input><div>元素显示在form的右侧。

1 个答案:

答案 0 :(得分:1)

包装:

<div class="input-group-addon">
             <i class="fa fa-server"></i>
</div>
<input type="number" id="txtResltsPerPage" class="form-control" ng-model="pageSize" placeholder="Results per Page 10">  

使用<div class="pull-right"></div>,请参阅Docs有关帮助程序类浮动

的信息