Visit Mozilla.org

CSS:clear

From MDC

« CSS Reference

[edit] Summary

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

[edit] Syntax

clear: none | left | right | both | inherit

[edit] Values

  • none : Element is not moved down to clear past floating elements.
  • left : Element is moved down to clear past left floats.
  • right : Element is moved down to clear past right floats.
  • both : Element is moved down to clear past both left and right floats.

[edit] Examples

View Live Examples

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

[edit] Notes

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

When it applies 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 it applies 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.

[edit] Specifications

[edit] Browser compatibility

Browser Lowest Version
Internet Explorer 4
Firefox 1
Netscape 4
Mozilla 1


[edit] See also

float