Why doesn't the height of a container element increase if it contains floated elements?

后端 未结 7 933
情书的邮戳
情书的邮戳 2020-11-21 11:37

I would like to ask how height and float work. I have an outer div and an inner div that has content in it. Its height may vary depending on the content of the inner div but

7条回答
  •  遥遥无期
    2020-11-21 12:04

    Its because of the float of the div. Add overflow: hidden on the outside element.

    Demo

提交回复
热议问题