CSS clear Property
Example
The <p> element is pushed below left floated elements (the <p> element do not allow floating elements on the left side):
img
{
float: left;
}
p.clear
{
clear: left;
}
Try it Yourself »
Definition and Usage
The clear
property controls the flow next to
floated elements.
The clear
property specifies what
should happen with the element that is next to a floating element.
Tip: Also look at the
float
property.
Default value: | none |
---|---|
Inherited: | no |
Animatable: | no. Read about animatable |
Version: | CSS1 |
JavaScript syntax: | object.style.clear="both" Try it |
Browser Support
The numbers in the table specify the first browser version that fully supports the property.
Property | |||||
---|---|---|---|---|---|
clear | 1.0 | 5.0 | 1.0 | 1.0 | 6.0 |
CSS Syntax
clear: none|left|right|both|initial|inherit;
Property Values
Value | Description | Demo |
---|---|---|
none | Default. The element is not pushed below left or right floated elements | Demo ❯ |
left | The element is pushed below left floated elements | Demo ❯ |
right | The element is pushed below right floated elements | Demo ❯ |
both | The element is pushed below both left and right floated elements | Demo ❯ |
initial | Sets this property to its default value. Read about initial | |
inherit | Inherits this property from its parent element. Read about inherit |
Related Pages
CSS tutorial: CSS Float
HTML DOM reference: clear property