Categories
Uncategorized

Float & Clear with CSS

Use the following to prevent text inside the editable region under a div with a menu bar from floating up along side the menu bar as it adjusts inside a fluid layout:

Use the “Float” property to specify whether or not an element should float.

Use the “Clear” property to control the behavior of floating elements.

Float Property

The “Float” property can be used to wrap text around images.

Clear Property

The “Clear” property is used to control the behavior of floating elements.

Elements after a floating element will flow around it. To prevent this, use the “Clear” property.

The “Clear” property specifies on which sides of an element floating elements are not allowed to float.

So for the div that contains the menu bar, float the div to the left and set the clear to “right.”

(Must use both.)