Height of outer div not expanding with inner div

后端 未结 5 1906
遇见更好的自我
遇见更好的自我 2020-12-30 03:52

I have a bodyMain div of 100% width. Inside it is a body div 800px with auto margin(can I use \'body\' as id ?). Inside this are two divs bodyLeft and bodyRight 200px and 60

5条回答
  •  忘掉有多难
    2020-12-30 04:25

    You must add

    at the end of floating div to fix this issue. see here

    Problem happens when a floated element is within a container box and element does not automatically force the container’s height adjust to the floated element. When an element is floated, its parent no longer contains it because the float is removed from the flow. You can use 2 methods to fix it:

    clear:both
    clearfix
    

提交回复
热议问题