CSS clear
Property
Topic: CSS3 Properties ReferencePrev|Next
Description
The clear
CSS property specifies which sides of an element where other floating elements are not allowed. Learn more.
The following table summarizes the usages context and the version history of this property.
Default value: | none |
---|---|
Applies to: | All elements |
Inherited: | No |
Animatable: | No. See animatable properties. |
Version: | CSS 1, 2, 3 |
Syntax
The syntax of the property is given with:
The example below shows the clear
property in action.
Example
Try this code »clearfix:after {
content: ".";
display: block;
height: 0;
visibility: hidden;
clear: both;
}
Property Values
The following table describes the values of this property.
Value | Description |
---|---|
left |
The element is moved down to clear past left floats. |
right |
The element is moved down to clear past right floats. |
both |
The element is moved down to clear past both left and right floats. |
auto |
Doesn,t clear any previously floated elements. This is default. |
initial |
Sets this property to its default value. |
inherit |
If specified, the associated element takes the computed value of its parent element clear property. |
Browser Compatibility
The clear
property is supported in all major modern browsers.
Basic Support—
|
Further Reading
See tutorial on: CSS Float.
Related properties: float
.