使用引导程序设置垂直高度组件

时间:2017-06-20 11:20:40

标签: html css twitter-bootstrap

无法找到如何将所有组件垂直居中,具体取决于"选择"高度(并删除这个脏"填充"技巧!!)

null <= 1990

1 个答案:

答案 0 :(得分: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;
   }

或尝试使用flex-box

希望这会有所帮助..