1. 程式人生 > >div動態元素自適應高度

div動態元素自適應高度

<div class="tpsetbox" ng-repeat="item in items"  >
                <div class="tpsettitbox"><span ng-bind="item.BuildName"></span>-<span ng-bind="item.PeriodName"></span></div>
                <ul class="tpsetbuildingul">
                    <li ng-repeat="it in item.Building" class="col-xs-3 ">
                        <span  ng-click="checkBuildingStatus($parent.$index,$index,it.Status)"  style="position:relative;">
                            <label  ng-bind="it.BuildingName"></label>
                            <i class="fa fa-chevron-down buildcontrol"></i>
                            <span class="setBuildStatus status0 hide stat0{{$parent.$index}}{{$index}} ">已推盤</span>
                            <span class="setBuildStatus status1 hide stat1{{$parent.$index}}{{$index}} ">未推盤</span>
                            <span class="setBuildStatus status2 hide stat2{{$parent.$index}}{{$index}} ">不可推</span>
                        </span>
                        
                    </li>
                </ul>
                <div style="font: 0px/0px sans-serif;clear: both;display: block"> </div> 
            </div>


以上是一種方法,在元素中間增加一個元素

<div style="font: 0px/0px sans-serif;clear: both;display: block"> </div>

還有一種方法是:

.tpsetbox{
   min-height:50px; height:100%;overflow:hidden;
}