clear property CSS Reference



Definition and Usage

The clear CSS property specifies whether an element can be next to floating elements that precede it or must be moved down (cleared) below them.

The clear property applies to both floating and non-floating elements.

When applied to non-floating blocks, it moves the border edge of the element down until it is below the margin edge of all relevant floats. This movement (when it happens) causes margin collapsing not to occur.

When applied to floating elements, it moves the margin edge of the element below the margin edge of all relevant floats. This affects the position of later floats, since later floats cannot be positioned higher than earlier ones.

The floats that are relevant to be cleared are the earlier floats within the same block formatting context.

  • Initial none
  • Applies to block-level elements
  • Inherited no
  • Media visual
  • Computed Value as specified
  • Animatable no
  • Canonical order the unique non-ambiguous order defined by the formal grammar

Syntax

Formal syntax: none | left | right | both
clear: none
clear: left
clear: right
clear: both
clear: inherit

Values

none
The element is not moved down to clear past floating elements.
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.

Examples

h1 { clear: none }
h2 { clear: right }

Compatibility

Desktop browsers

FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari
Basic support1.01.0 (1.7 or earlier)4.03.51.0

Mobile browsers

FeatureAndroidFirefox Mobile (Gecko)IE PhoneOpera MobileSafari Mobile
Basic support1.01.0 (1)6.06.01.0

Relative articles