父元素div自适应高度方法一:overflow:hidden
<div class="parent1">
<div class="left1">left</div>
<div class="right1">right</div>
</div>
<style>
.parent1{ background-color:#3D4ADC; overflow:hidden;/*父元素自适应高度被撑开*/}
.left1{ float:left; width:100px; height:100px; background-color:#F5090D;}
.right1{ float:right; width:100px; height:100px; background-color:#EBA307;}
</style>
父元素div自适应高度方法二:overflow:auto
<div class="parent2">
<div class="left2">left</div>
<div class="right2">right</div>
</div>
<style>
.parent2{ background-color:#3D4ADC; overflow:auto;/*父元素自适应高度被撑开*/}
.left2{ float:left; width:100px; height:100px; background-color:#F5090D;}
.right2{ float:right; width:100px; height:100px; background-color:#EBA307;}
</style>