CSS float Property
Description
The float property takes an element out of the normal inline flow in a horizontal sense so that other inline content (text, inline elements) can wrap around it. A floated element is shifted to the side of its containing block and subsequent inline-level content flows alongside it until the float ends; however, the float still participates in the block layout in that it affects the vertical placement of following block-level boxes. Because floats influence how surrounding content wraps, they are frequently used for image/text wrapping and for small, flow-sensitive layout pieces where content should flow around a visual element rather than sit above or below it.
Floats interact with the layout of their container in ways that can be surprising: a container that only contains floated children can appear to collapse because floats are taken out of the normal flow for block layout. To manage that interaction you commonly use clearing techniques - for example the clear property on subsequent elements to stop wrapping, or you create a block formatting context for the containing box (often done via properties such as overflow) so the container expands to include its floats. These interactions also influence how margins and adjacent boxes are calculated, so it’s important to think about containment and clearing whenever floats are involved.
In modern layout practice, floats are best treated as a tool for content wrapping and not as a primary mechanism for large-scale page layout. For two-dimensional or responsive layouts, consider layout systems available through the display property or explicit control with the position property, which tend to be clearer and less error-prone. When you do use floats, combine them with explicit clearing or a clearfix pattern so containers behave predictably, and keep an eye on source order and accessibility since floated elements can change how content is perceived by assistive technologies and users navigating by flow.
Definition
- Initial value
- none
- Applies to
- All except for positioned elements and generated content
- Inherited
- No
- Computed value
- As specified
- Animatable
- No
- JavaScript syntax
- object.style.cssFloat
Interactive Demo
Syntax
float: [ left | right | top | bottom | start | end | none | <page-floats> ] && contour?
Values
- leftThe left value indicates that the element must float to the far left side of its containing block.
- rightThe right value indicates that the element must float to the far right side of its containing block.
- topSame as 'left'
- bottomsame as 'right'
- startIf the 'direction' property is 'ltr', the same as 'left'; otherwise the same as 'right'.
- endIf the 'direction' property is 'rtl', the same as 'right'; otherwise the same as 'left'.
- noneIndicates that the element does not contain any float at all. This is the initial value of the float property.
Example
Browser Support
The following information will show you the current browser support for the CSS float property. Hover over a browser icon to see the version that first introduced support for this CSS property.
This property is supported by all modern browsers.
Desktop
Tablets & Mobile
Last updated by CSSPortal on: 1st January 2026
