The clear CSS property specifies if an element can be positioned next to or must be positioned below the floating elements that precede it in the markup.
Overview tablenone
clear
clear: both
clear: inherit
clear: left
clear: none
clear: right
Example of clear:none;
in use.
p{
clear: none;
}
Example of clear: left;
in use.
p{
clear: left;
}
Example of clear: right;
in use.
p{
clear: right;
}
Example of clear: both;
in use.
p{
clear: both;
}
Moving a footer below all floated content above.
<h1>Clearing Floats</h1>
<div id="box"><code>float:left</code></div>
<p>Paragraphs are typically <code>clear: none;</code> by default, and are frequently used in conjuction with a floated image. In this example,
pretend the black box labeled <code>float:left;</code> is an image floated left. </p>
<p><a href="javascript:void()" id="toggleClear">Toggle the clear settings on the footer</a></p>
<footer id="footer">This is a footer.</footer>
Notes
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.
Related specificationsclear
Mozilla Developer Network : Article
Microsoft Developer Network: Windows Internet Explorer API reference Article
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4