Home >Web Front-end >HTML Tutorial >Why is the parent div's clientHeight smaller than its child's clientHeight? _html/css_WEB-ITnose
How can I make the height of the parent div increase as the height of the child div increases?
Such as
eaa6db6fe9970711f508dfbeabf14017
c3456518cab7ce3cddfa3d3fa66b17f6
16b28748ea4df4d9c2150843fecfba68
16b28748ea4df4d9c2150843fecfba68
partition 1 has a height of 100px. The height of partition 2 is 200px. How is this result caused?
Use float, clear float
Use float Well, clear float
Reference
<div style="background:red;"> <div style="display:inline-block;">aaaaaa</div><div style="display:inline-block;">cccc<br>bbbbb</div> </div> <br><div style="background:red;"> <div>aaaaaa</div><div style="float:right;">cccc<br>bbbbb</div> <div style="clear:both;"></div> </div>
Use float, clear float