Home >Web Front-end >HTML Tutorial >Why is the parent div's clientHeight smaller than its child's clientHeight? _html/css_WEB-ITnose

Why is the parent div's clientHeight smaller than its child's clientHeight? _html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:53:181016browse

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?


Reply to discussion (solution)

Use float, clear float

Use float Well, clear float


Well, I used it, and it was indeed caused by it. If I don’t use it, how can I make the two divs line up?

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


Well, I used it, it turned out to be it Caused by this, if you don't use it, how can you make the two divs line up?
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn