CSS PROPERTIES
Expand All|Collapse All
CSS AT-RULES
SPONSORED LINKS

CSS clear Property

Topic: CSS3 Properties Reference« Prev|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:

clear left | right | auto | both | none | initial | inherit

The example below shows the clear property in action.

  • 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.

Browsers Icon

Basic Support—

  • Firefox 1+
  • Google Chrome 1+
  • Internet Explorer 5+
  • Apple Safari 1+
  • Opera 6+

Further Reading

See tutorial on: CSS Float.

Related properties: float.

 
Close

Your Feedback:

 

We would love to hear from you! Please say something.