Example
No floating elements allowed on the left or the right side of a specified <p> element:
img
{
float: left;
}
p.clear
{
clear: both;
}
Try it Yourself »
Definition and Usage
The clear property specifies on which sides of an element floating elements are not allowed to float.
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 |
---|---|
none | Default. Allows floating elements on both sides |
left | No floating elements allowed on the left side |
right | No floating elements allowed on the right side |
both | No floating elements allowed on either the left or the right side |
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