Controlling Where Elements Float

You can control which elements an element can float next to and which it cannot. To keep an element from floating next to something it shouldn’t, use the clear property.

To control where elements float:

1.
Type clear:.
2.
Type left to keep elements from floating to the left of the element you’re styling. Or type right to keep elements from floating to the right of the element you’re styling. Or type both to keep elements from floating to either side of the element you’re styling. Or type none to let elements flow to either side of the element you’re styling.
Figure 11.38. Since it is the main div that is floating, all of the other elements, including the footer, flow around it unless we say otherwise.

Get HTML, XHTML, & CSS, Sixth Edition: Visual QuickStart Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.