-
Floats — Applying a float value such as left can cause block-level elements to wrap along one side of an element. Source
-
The float CSS property places an element on the left or right side of its container, allowing text and inline elements to wrap around it. Source
So float is used to wrap block elements around another element or it is used to wrap inline elements around another element? Why is there a difference in two sources?
The most relevant part of the specification says:
See this example:
The
divpasses through the float (you can see the outlines overlapping) while the line boxes generated by the text inside it wrap around the float.Note that its about the boxes that are generated by the element and text, not the elements themselves.
Because MDN is: