2017-03-27 64 views
0

旁邊輸入ALWAYS反饋圖標在設計表單時輸入的寬度比100%反饋圖標不旁邊的地方吧:如何放置在引導

<div class="form-group has-success has-feedback"> 
    <label class="control-label col-sm-3" for="inputSuccess3">Input with success</label> 
    <div class="col-sm-9"> 
     <input class="form-control" id="inputSuccess3" aria-describedby="inputSuccess3Status" style="width: 40%;" type="text"> 
     <span class="glyphicon glyphicon-ok form-control-feedback" aria-hidden="true"></span>      
    </div> 
</div> 

,如果我給的風格輸入到了width:40%反饋圖標的地方並沒有改變:

enter image description here

Demo

如何I C即使在寬度或顯示寬度發生變化時,始終在輸入旁邊放置一個位置反饋圖標。

感謝

回答

2

當使用形式電網的cols,確保它有form-horizontal類。對於has-feedback圖標,必須在輸入容器上設置寬度。在這種情況下,您可以使用col-sm-5,因爲它的寬度是〜41%。

<form class="form-horizontal"> 
     <div class="form-group has-success has-feedback"> 
      <label class="control-label col-sm-3" for="inputSuccess3">Input with success</label> 
      <div class="col-sm-5"> 
       <input class="form-control" id="inputSuccess3" aria-describedby="inputSuccess3Status" type="text"> 
       <span class="glyphicon glyphicon-ok form-control-feedback" aria-hidden="true"></span> 
      </div> 
     </div> 
    </form> 

Demo

+0

謝謝,但由於某些原因考慮,我不能用'COL-SM-5',我想設置寬度手動 – Arian

+2

當你想手動設置寬度,最好的辦法是將圖標設置爲輸入的背景圖像,而不是html中的單獨標籤。 –

相關問題