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

前端 未结 10 958
灰色年华
灰色年华 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:42

    As Lucas says, what you are describing is the intended behaviour for the float property. What confuses many people is that float has been pushed well beyond its original intended usage in order to make up for shortcomings in the CSS layout model.

    Have a look at Floatutorial if you'd like to get a better understanding of how this property works.

提交回复
热议问题