Float
float
places an element on the left or right side of its container, allowing other content to wrap around it.
Basic Concepts
A floating element is one whose float
value is not none
.
An element will float until it hits the left/right side of its container, or until it hits another floating element.
Float Implies Block Layout
float
implies the use of the block layout. The browser changes "inline" display
values of floating elements to the block variants, e.g.:
display: inline
→display: block
display: inline-block
→display: block
display: inline-flex
→display: flex
display: inline-grid
→display: grid
Clearing Floats
Specifying clear
property on an element (e.g. clear: left
) will move the element down such that it does not wrap around floating elements on the cleared side.

Float Properties
float
Sets how the element floats. Possible values:
none
— the element does not float (default)left
— the element floats to the leftright
— the element floats to the rightinline-start
— the element floats to the start side of the writing directioninline-end
— the element floats to the end side of the writing direction
clear
Specifies which side(s) to clear of floats. (The element will move down such that it does not wrap around floating elements on the cleared side.)
none
— don't clear floats (default)both
— clear floats on both sidesleft
— clear floats on the left sideright
— clear floats on the right sideinline-start
— clear floats on the start side of the writing directioninline-end
— clear floats on the end side of the writing direction
References
- float (MDX) — https://developer.mozilla.org/en-US/docs/Web/CSS/float