Floating elements within a div, floats outside of div. Why?

前端 未结 10 1098
灰色年华
灰色年华 2020-11-22 05:10

Say you have a div, give it a definite width and put elements in it, in my case an img and another div.

The idea

10条回答
  •  不知归路
    2020-11-22 05:28

    Here's more modern approach:

    .parent {display: flow-root;} 
    

    No more clearfixes.

    p.s. Using overflow: hidden; hides the box-shadow so...

提交回复
热议问题