CSS clear

The CSS clear property is used to for control flow when using the float property. You can specify whether to keep one or both sides of an element "clear" (i.e. no elements can appear on the side that is clear).

Specifically, the clear property indicates which sides of an element's box(es) may not be adjacent to an earlier floating box. In other words, it specifies whether or not an element can be positioned next to floating elements that precede it or it must be moved down (cleared) below them.

Syntax

clear: 	none | left | right | both

Possible Values

none
Specifies no clearance. There's no constraint on the box's position with respect to floats.
left
Specifies that the element is moved down to clear past left floats. The top border edge of the box is below the bottom outer edge of any left-floating boxes that resulted from elements earlier in the source document.
right
Specifies that the element is moved down to clear past right floats. The top border edge of the box is below the bottom outer edge of any right-floating boxes that resulted from elements earlier in the source document.
both
Specifies that the element is moved down to clear past both left and right floats. The top border edge of the box is below the bottom outer edge of both any right-floating and left-floating boxes that resulted from elements earlier in the source document.

Logical Values

The following values have been proposed for the clear property in CSS3:

  • inline-start
  • inline-end

In addition, all CSS properties also accept the following CSS-wide keyword values as the sole component of their property value:

initial
Represents the value specified as the property's initial value.
inherit
Represents the computed value of the property on the element's parent.
unset
This value acts as either inherit or initial, depending on whether the property is inherited or not. In other words, it sets all properties to their parent value if they are inheritable or to their initial value if not inheritable.

General Information

Initial Value
none
Applies To
Block-level elements
Inherited?
No
Media
Visual

Example Code

div {
  clear: both;
}

Official Specifications