2016-10-04 47 views
0

我有一個用戶界面,引導日期選擇器UI引導日期選擇器沒有對準

<div class="col-md-2"> 

    <label for="datepicker">Select Date<span class="compulsary">*</span></label><br> 

    <input type="text" class="form-control" uib-datepicker-popup ng-model="dt" is-open="popup2.opened" datepicker-options="dateOptions" ng-required="true" close-text="Close" id="datepicker"/> 
    <span class="input-group-btn"> 
    <button type="button" class="btn btn-default" ng-click="open2()"><i class="glyphicon glyphicon-calendar"></i></button> 
    </span> 

</div> 

這是css來輸入字段

#datepicker{ 
    height: 50px; 
    width: 60%; 
} 

日曆按鈕出現在輸入欄的下方,而不是除了它,就好像一個<br>已經應用到它。我希望按鈕出現在字段旁邊。我怎樣才能做到這一點?

+0

請問你能做一個工作片段嗎?同時向我們展示它的外觀截圖,以便我們可以幫助您。 –

回答

2

根據Bootstrap,您應該使用input groups

<div class="col-md-2"> 

    <label for="datepicker">Select Date<span class="compulsary">*</span></label><br> 

    <div class="input-group"> 
     <input type="text" class="form-control" uib-datepicker-popup ng-model="dt" is-open="popup2.opened" datepicker-options="dateOptions" ng-required="true" close-text="Close" id="datepicker"/> 
     <span class="input-group-btn"> 
      <button type="button" class="btn btn-default" ng-click="open2()"><i class="glyphicon glyphicon-calendar"></i></button> 
     </span> 
    </div> 

+0

謝謝!像魅力一樣工作! –

0

我認爲你正在尋找horizontal forms

<form class="form-horizontal"> 
    <div class="form-group"> 
     <label for="datepicker">Select Date<span class="compulsary">*</span></label> 
     <input type="text" class="form-control" uib-datepicker-popup ng-model="dt" is-open="popup2.opened" datepicker-options="dateOptions" ng-required="true" close-text="Close" id="datepicker"/> 
    </div> 
</form>