Clearing the Float

Elements that come after the floating element will flow around it. To avoid this, use the clear property.

The clear property specifies the side of an element where other floating elements are not allowed to be.

In the example below, if we set the float property to the div, only the paragraph that comes after the div will be wrapped around the image.

This paragraph is above the div element and is not affected by the float right property.

This paragraph also comes after the div element and is affected by the float right property.



Using clear

Use the values right, left and both to specify the side of an element where other floating elements are not allowed to be.

The default is none, which allows floating elements on both sides.

This paragraph is above the div element and is not affected by the float right property.

This paragraph also comes after the div element and is affected by the float right property.

This paragraph is out of the floating group and is not affected by the flaot right propery.