自举

2017-06-20 67 views
0

设置垂直高度组件不能找出如何将所有元件垂直居中取决于“中选择”高度(并删除这个肮脏的“填充”招!!)自举

<form class="form-horizontal"> 
     <div class="form-group" > 
      <label class="control-label col-sm-2" style="padding-top:25px;">test</label> 
     <div class="col-sm-2 " style="padding-top:20px;"> 
     <select class="form-control"> 
         <option>1</option> 
         <option>2</option> 
     </select> 
     </div> 
     <div class="col-sm-3"> 

     <select multiple class="form-control"> 
      <option>1</option> 
      <option>2</option> 
     </select> 
     </div> 
    </div> 
    </form> 

回答

0

给一个尝试

HTML

<form class="form-horizontal"> 
     <div class="form-group" > 
     <div class="clearfix align-items"> 
     <div> 
      <label class="control-label col-sm-2">test</label> 
     </div> 

     <div class="col-sm-2 "> 
     <select class="form-control"> 
         <option>1</option> 
         <option>2</option> 
     </select> 
     </div> 
     <div class="col-sm-3"> 
     <select multiple class="form-control"> 
      <option>1</option> 
      <option>2</option> 
      <option>1</option> 
      <option>2</option> 
      <option>1</option> 
      <option>2</option> 
     </select> 
     </div> 
</div> 

    </div> 
    </form> 

CSS

.align-items 
    { 
    display: table; 
    } 
    .align-items > div 
    { 
     display: table-cell; 
     vertical-align: middle; 
     float: none; 
    } 

或尝试使用弹性盒

希望这可以帮到..