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
Release: 2016-06-24 11:53:18
Original
1031 people have browsed it

How can I make the height of the parent div increase as the height of the child div increases?
Such as





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>
Copy after login



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?
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template