CSS property: clear
Description
This property indicates which sides of an element's box(es) may not be adjacent to an earlier floating box.
The clear property does not consider floats inside the element itself or in other block formatting contexts.
Values other than none
potentially introduce clearance. Clearance inhibits margin collapsing and acts as spacing above the margin-top of an element. It is used to push the element vertically past the float.
Syntax
clear: none | left | right | both;
Values
- none (by default)
- No constraint on the box's position with respect to floats.
- left
- The clearance of the generated box is set to the amount necessary to place the top border edge below the bottom outer edge of any left-floating boxes that resulted from elements earlier in the source document.
- right
- The clearance of the generated box is set to the amount necessary to place the top border edge below the bottom outer edge of any right-floating boxes that resulted from elements earlier in the source document.
- both
- The clearance of the generated box is set to the amount necessary to place the top border edge below the bottom outer edge of any right-floating and left-floating boxes that resulted from elements earlier in the source document.
Versions
Examples
h1 { clear: both; }