The parent div changes with the height of the child div

1. In general, when the minimum height of the parent container is set , the parent container will change with the content of the child.

2. Special circumstances: floating

       Problem: When the child container contains floating attributes, the parent container will not change with the change of the child container. If the content of the child container is too much, it will overflow the parent container, making the entire page content mess

      Solution: After the last child of container add the following code, clear float can

//清除浮动
<div style="clear:both;"></div>

 

Published 77 original articles · 100 likes · 70,000+ views

Guess you like

Origin blog.csdn.net/super_DuoLa/article/details/102796461