CSS clear property

Description

CSS clear property decides whether the elements should be floated on either side of the floated element or not.


We'll take an example of three boxes. We will apply float property to all of the three boxes. And then we will check the behavior of clear property for the green box only.

Syntax

clear : none | left | right

Property values

noneDefault

If the elements are floating on either right or left side then none value allows the flow of other boxes on both sides of the current (green) box.

clear: none;

left

If the boxes are floating on the left side then this value does not allow the flow of boxes on the left side of the current (green) box.

There is no box on the left side of the green box.

clear: left;

right

If the boxes are floating on the left side then this value does not allow the flow of boxes on the right side of the current box.

There is no box on the right side of the green box.

clear: right;

Applicable to

It applies to all elements

#CSS digger
Was this article helpful?

 
This is the left block. Observe the effect of clear property for different values.
This is the inner block. Observe the effect of clear property for different values.
This is the right block. Observe the effect of clear property for different values.
×

Ctrl+D