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

后端 未结 7 1013
情书的邮戳
情书的邮戳 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 11:54

    You need to add overflow:auto to your parent div for it to encompass the inner floated div:

    jsFiddle example

提交回复
热议问题