The clear property controls how elements behave around floated content. It helps you fix overlap and keep footers, paragraphs, and sections in the right place.
01
Float Layout
Works with floated boxes.
02
Syntax
Direction keywords.
03
none Default
No clearing by default.
04
both
Clear all floats.
05
left / right
Clear one side only.
06
Clearfix
Classic layout pattern.
Fundamentals
Definition and Usage
The clear CSS property controls the behavior of elements around floating content. When elements are floated using the float property, they are removed from normal document flow and other content can wrap beside them.
The clear property specifies whether an element should be moved below (cleared) floating elements that precede it. This prevents unwanted overlap and keeps your layout readable.
💡
Beginner Tip
Think of float as pulling boxes to the side, and clear as telling the next element, “Start on a new line below those floated boxes.”
Foundation
📝 Syntax
The syntax for clear is straightforward — you choose which floats to clear:
Apply clear to the element that should drop below preceding floats.
Works with elements that have float: left or float: right above them.
Modern layouts often use Flexbox or Grid, but clear remains essential for float-based designs.
Cheat Sheet
⚡ Quick Reference
Question
Answer
Initial value
none
Applies to
Block-level and floated elements
Inherited
No
Animatable
No
Common use
Footers and sections below floated images or columns
Reference
💎 Property Values
The clear property accepts keyword values that describe which floats to move past.
Value
Example
Meaning
none
clear: none;
The element is not moved down to clear past floating elements. This is the default.
left
clear: left;
The element is moved down to clear past left-floating elements.
right
clear: right;
The element is moved down to clear past right-floating elements.
both
clear: both;
The element is moved down to clear past both left- and right-floating elements.
inline-start
clear: inline-start;
Clears floats on the start side of the inline direction (logical equivalent of left in LTR).
inline-end
clear: inline-end;
Clears floats on the end side of the inline direction (logical equivalent of right in LTR).
noneleftrightbothinline-startinline-end
Context
clear and float Together
clear only matters when floats exist above an element in the document. Typical workflow:
Float images, sidebars, or columns with float: left or float: right.
Content that follows may wrap beside those floats.
Apply clear on the next block that should start below all floats — often a footer, heading, or full-width section.
A common pattern is the clearfix: a helper element (or pseudo-element) with clear: both placed after floated children so a parent container expands to contain them.
Preview
👀 Live Preview
Compare what happens without clear versus with clear: both on the content block below two floated boxes.
Without clear (content wraps beside floats)
Box 1
Box 2
This content wraps beside the floated boxes because clear is not set.
With clear: both (content drops below)
Box 1
Box 2
This content moves below both floated boxes because clear: both is applied.
Hands-On
Examples Gallery
Try clear: both, side-specific clearing, a floated image layout, and a footer clearfix pattern.
📝 Basic Clearing
Start with the reference example — two left-floated boxes and a cleared content block below them.
Example 1 — clear: both with Floated Boxes
Ensure a section moves below floating boxes on both sides.
The clear: both rule moves “Cleared Content” below both floated boxes instead of wrapping beside them.
Example 2 — clear: left
Clear only left-floating elements while still allowing content beside right floats.
clear-left.html
<style>.float-left{float:left;width:80px;height:80px;background:#fde68a;}.float-right{float:right;width:80px;height:80px;background:#fbcfe8;}.clear-left{clear:left;background:#e0e7ff;padding:8px;}</style><divclass="float-left">Left</div><divclass="float-right">Right</div><divclass="clear-left">Clears left float only</div>
clear: left drops the element below left floats but does not necessarily clear right floats on the same line.
🖼️ Layout Patterns
Use clear in real page layouts with floated images and footers.
Example 3 — Floated Image with clear: right
Place a caption block below a right-floated image using clear: right.
clear-right.html
<style>img{float:right;width:120px;margin:0 0 8px 12px;}.caption{clear:right;font-size:0.875rem;color:#64748b;}</style><imgsrc="photo.jpg"alt="Sample"><p>Text wraps beside the image on the left.</p><pclass="caption">Caption clears below the image.</p>
Without clear: both on the footer, it could overlap or sit beside the floated columns. Clearing forces it to start on a new line below them.
🧠 How clear Works
1
Elements are floated
Images, boxes, or columns use float: left or float: right and leave normal flow.
float
2
Following content may wrap
Without clearing, the next block can sit beside floats and create cramped or overlapping layout.
Normal flow
3
You apply clear
Set clear: left, right, or both on the element that should start below floats.
CSS rule
=
📋
Clean layout below floats
The cleared element moves down past the specified floats, preventing overlap and restoring predictable flow.
Compatibility
Universal Browser Support
The clear property is supported in all modern browsers, including Chrome, Firefox, Safari, Edge, and Opera. It has wide compatibility and can be used reliably in web development.
✓ Baseline · All browsers
Reliable float clearing everywhere
clear has been supported since the early days of CSS and works consistently across browsers.
99%Global browser support
Google ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions
Full support
OperaAll modern versions
Full support
clear property99% supported
Bottom line: Use clear with confidence. Logical values inline-start and inline-end are supported in modern browsers for internationalized layouts.
Wrap Up
Conclusion
The clear property is an essential tool for managing the layout of elements in the presence of floating content. By using this property, you can control the flow of elements and prevent unwanted overlap or misalignment caused by floating elements.
Understanding and utilizing clear effectively helps you create more precise and visually appealing layouts — especially when working with float-based designs or maintaining legacy code.
Use clear: both for footers and full-width sections below floats
Pair clear with floats when building classic column layouts
Use logical values (inline-start, inline-end) for RTL-aware layouts
Apply clearfix helpers when a parent must contain floated children
Prefer Flexbox or Grid for new layout projects when possible
❌ Don’t
Forget to clear floats before a footer or major section break
Confuse clear with the cursor or overflow properties
Overuse floats in new projects when Flexbox or Grid is simpler
Assume clear: left also clears right floats — use both when needed
Leave floated containers without a clearing strategy (collapsed height issues)
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about clear
Use these points when fixing float layout issues.
5
Core concepts
🔀01
Below Floats
Moves element down.
Purpose
⚙02
none Default
No clearing unless set.
Default
↔03
left / right / both
Pick which side to clear.
Values
📝04
Works with float
Companion to float.
Context
🛸05
Universal support
Works everywhere.
Browser
❓ Frequently Asked Questions
clear moves an element below preceding floated elements. It prevents the element from sitting beside floats and instead starts on a new line below them.
The initial value is none. With none, the element does not clear past floating elements unless you set left, right, both, inline-start, or inline-end.
float pulls an element out of normal flow so content wraps around it. clear is applied to a later element to stop it from wrapping beside those floats.
Use clear: both when you want an element to drop below all left and right floats above it. It is common for footers, section breaks, and clearfix helpers.
Modern layouts often use Flexbox or Grid instead of floats. clear remains important for understanding float-based layouts and for maintaining older code that still uses floats.